Skip to content

Commit

Permalink
cleanup: remove global scope event for slither compat, update Makefil…
Browse files Browse the repository at this point in the history
…e, ugrade deps, add solc version to foundry.toml
  • Loading branch information
burnto committed Jan 23, 2024
1 parent 375947f commit 8664005
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

# .SILENT:

LIVENET_DEPLOY_COMMAND = forge script script/PizzaFactory.s.sol:DeployPizzaFactory --private-key ${PRIVATE_KEY} -vvvv

.PHONY: all test clean

all: clean update build
all:; forge test -vvv -w

# Clean the repo
clean :; forge clean
Expand Down Expand Up @@ -34,13 +36,11 @@ abi:
# solhint should be installed globally
lint :; solhint src/**/*.sol && solhint src/*.sol

anvil :; anvil -m 'test test test test test test test test test test test junk'

# use the "@" to hide the command from your shell
deploy-mainnet :; @forge script script/PizzaFactory.s.sol:DeployPizzaFactory --rpc-url mainnet --private-key ${PRIVATE_KEY} -vvvv
deploy-mainnet-dryrun :; @${LIVENET_DEPLOY_COMMAND} --rpc-url mainnet
deploy-sepolia-dryrun :; @${LIVENET_DEPLOY_COMMAND} --rpc-url sepolia

# use the "@" to hide the command from your shell
deploy-sepolia :; @forge script script/PizzaFactory.s.sol:DeployPizzaFactory --rpc-url sepolia --private-key ${PRIVATE_KEY} -vvvv
deploy-mainnet :; @${LIVENET_DEPLOY_COMMAND} --rpc-url mainnet --broadcast --verify
deploy-sepolia :; @${LIVENET_DEPLOY_COMMAND} --rpc-url sepolia --broadcast --verify

# anvil deploy with the default user
deploy-anvil :; @forge script script/PizzaFactory.s.sol:DeployPizzaFactory --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Copy the `.env.example` file to `.env` and fill in your own values.

## Testing

For this project I've gone ahead and just created a Makefile for common build targets. You can run tests with the bare `make` command:

```
make
```
Expand Down
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ src = "src"
out = "out"
libs = ["lib"]
via_ir = true
solc = "0.8.23"

[profile.forked]
fork_block_number = 18814000
Expand Down
2 changes: 1 addition & 1 deletion lib/forge-std
Submodule forge-std updated 1 files
+1 −1 scripts/vm.py
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts-upgradeable
7 changes: 5 additions & 2 deletions src/PizzaFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ pragma solidity 0.8.23;
import {Clones} from "openzeppelin-contracts/proxy/Clones.sol";
import {IPizzaInitializer} from "./IPizzaInitializer.sol";

event PizzaCreated(address indexed pizza, address indexed creator);

/**
* @title PizzaFactory
* @dev A contract for creating {IPizzaInitializer} splitter contracts.
*/
contract PizzaFactory {
/* ////////////////////////////////////////////////////////////////////////
Events
//////////////////////////////////////////////////////////////////////// */
event PizzaCreated(address indexed pizza, address indexed creator);

/* ////////////////////////////////////////////////////////////////////////
Storage
//////////////////////////////////////////////////////////////////////// */
Expand Down
4 changes: 2 additions & 2 deletions test/PizzaFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.23;

import {Test, console2} from "forge-std/Test.sol";
import {PizzaFactory, PizzaCreated} from "../src/PizzaFactory.sol";
import {PizzaFactory} from "../src/PizzaFactory.sol";
import {Pizza} from "../src/Pizza.sol";
import {Address} from "openzeppelin-contracts/utils/Address.sol";
import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol";
Expand All @@ -29,7 +29,7 @@ contract PizzaFactoryTest is Test {
function test_create(uint256 nonce) public {
address predicted = f.predict(payees, shares, 0, nonce);
vm.expectEmit(true, true, true, true);
emit PizzaCreated(predicted, address(this));
emit PizzaFactory.PizzaCreated(predicted, address(this));
Pizza p = Pizza(payable(address(f.create(payees, shares, nonce))));
assertEq(address(p), predicted);

Expand Down

0 comments on commit 8664005

Please sign in to comment.