Skip to content

Commit

Permalink
added make file
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymous961 committed Sep 12, 2024
1 parent f338b79 commit 957fb1c
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 0 deletions.
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
-include .env

.PHONY: all test clean deploy fund help install snapshot format anvil zktest

DEFAULT_ANVIL_KEY := 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
DEFAULT_ZKSYNC_LOCAL_KEY := 0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110

all: clean remove install update build

# Clean the repo
clean :; forge clean

# Remove modules
remove :; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"

install :; forge install cyfrin/[email protected] --no-commit && forge install smartcontractkit/[email protected] --no-commit && forge install foundry-rs/[email protected] --no-commit

# Update Dependencies
update:; forge update

build:; forge build

zkbuild :; forge build --zksync

test :; forge test

zktest :; foundryup-zksync && forge test --zksync && foundryup

snapshot :; forge snapshot

format :; forge fmt

anvil :; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1

zk-anvil :; npx zksync-cli dev start

deploy:
@forge script script/DeployFundMe.s.sol:DeployFundMe $(NETWORK_ARGS)

NETWORK_ARGS := --rpc-url http://localhost:8545 --private-key $(DEFAULT_ANVIL_KEY) --broadcast

ifeq ($(findstring --network sepolia,$(ARGS)),--network sepolia)
NETWORK_ARGS := --rpc-url $(SEPOLIA_RPC_URL) --account $(ACCOUNT) --broadcast --verify --etherscan-api-key $(ETHERSCAN_API_KEY) -vvvv
endif

deploy-sepolia:
@forge script script/DeployFundMe.s.sol:DeployFundMe $(NETWORK_ARGS)

# As of writing, the Alchemy zkSync RPC URL is not working correctly
deploy-zk:
forge create src/FundMe.sol:FundMe --rpc-url http://127.0.0.1:8011 --private-key $(DEFAULT_ZKSYNC_LOCAL_KEY) --constructor-args $(shell forge create test/mock/MockV3Aggregator.sol:MockV3Aggregator --rpc-url http://127.0.0.1:8011 --private-key $(DEFAULT_ZKSYNC_LOCAL_KEY) --constructor-args 8 200000000000 --legacy --zksync | grep "Deployed to:" | awk '{print $$3}') --legacy --zksync

deploy-zk-sepolia:
forge create src/FundMe.sol:FundMe --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} --account default --constructor-args 0xfEefF7c3fB57d18C5C6Cdd71e45D2D0b4F9377bF --legacy --zksync


# For deploying Interactions.s.sol:FundFundMe as well as for Interactions.s.sol:WithdrawFundMe we have to include a sender's address `--sender <ADDRESS>`
SENDER_ADDRESS := <sender's address>

fund:
@forge script script/Interactions.s.sol:FundFundMe --sender $(SENDER_ADDRESS) $(NETWORK_ARGS)

withdraw:
@forge script script/Interactions.s.sol:WithdrawFundMe --sender $(SENDER_ADDRESS) $(NETWORK_ARGS)
36 changes: 36 additions & 0 deletions broadcast/DeployFundMe.s.sol/11155111/run-1726128433.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"transactions": [
{
"hash": null,
"transactionType": "CREATE",
"contractName": "FundMe",
"contractAddress": "0xf6a14438979d42edfe772927cdc447a250c202cb",
"function": null,
"arguments": [
"0x694AA1769357215DE4FAC081bf1f309aDC325306"
],
"transaction": {
"from": "0x1cd8804d7efe697410df6d73e362bd72b77e92ea",
"gas": "0xb0144",
"value": "0x0",
"input": "0x60a060405234801561001057600080fd5b5060405161095638038061095683398101604081905261002f91610058565b33608052600280546001600160a01b0319166001600160a01b0392909216919091179055610088565b60006020828403121561006a57600080fd5b81516001600160a01b038116811461008157600080fd5b9392505050565b6080516108a56100b160003960008181610134015281816102fa015261044101526108a56000f3fe60806040526004361061007f5760003560e01c8063893d20e81161004e578063893d20e814610125578063b60d42881461008e578063be2693f01461016c578063d7b4750c146101815761008e565b80630343fb25146100965780630d8e6e2c146100df5780633ccfd60b146100f45780636b69a592146101095761008e565b3661008e5761008c6101a1565b005b61008c6101a1565b3480156100a257600080fd5b506100cc6100b13660046106e4565b6001600160a01b031660009081526020819052604090205490565b6040519081526020015b60405180910390f35b3480156100eb57600080fd5b506100cc61027c565b34801561010057600080fd5b5061008c6102ef565b34801561011557600080fd5b506100cc674563918244f4000081565b34801561013157600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016100d6565b34801561017857600080fd5b5061008c610436565b34801561018d57600080fd5b5061015461019c36600461070d565b61057f565b600254674563918244f40000906101c29034906001600160a01b03166105af565b10156102155760405162461bcd60e51b815260206004820152601b60248201527f596f75206e65656420746f207370656e64206d6f72652045544821000000000060448201526064015b60405180910390fd5b336000908152602081905260408120805434929061023490849061073c565b90915550506001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b03191633179055565b6002546040805163054fd4d560e41b815290516000926001600160a01b0316916354fd4d509160048083019260209291908290030181865afa1580156102c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ea919061074f565b905090565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103385760405163579610db60e01b815260040160405180910390fd5b60005b60015481101561038e5760006001828154811061035a5761035a610768565b60009182526020808320909101546001600160a01b03168252819052604081205550806103868161077e565b91505061033b565b5060408051600081526020810191829052516103ac9160019161066a565b50604051600090339047908381818185875af1925050503d80600081146103ef576040519150601f19603f3d011682016040523d82523d6000602084013e6103f4565b606091505b50509050806104335760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b604482015260640161020c565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461047f5760405163579610db60e01b815260040160405180910390fd5b60015460005b818110156104d6576000600182815481106104a2576104a2610768565b60009182526020808320909101546001600160a01b03168252819052604081205550806104ce8161077e565b915050610485565b5060408051600081526020810191829052516104f49160019161066a565b50604051600090339047908381818185875af1925050503d8060008114610537576040519150601f19603f3d011682016040523d82523d6000602084013e61053c565b606091505b505090508061057b5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b604482015260640161020c565b5050565b60006001828154811061059457610594610768565b6000918252602090912001546001600160a01b031692915050565b6000806105bb836105e7565b90506000670de0b6b3a76400006105d28684610797565b6105dc91906107ae565b925050505b92915050565b600080826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610628573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064c91906107ef565b505050915050806402540be400610663919061083f565b9392505050565b8280548282559060005260206000209081019282156106bf579160200282015b828111156106bf57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061068a565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b6000602082840312156106f657600080fd5b81356001600160a01b038116811461066357600080fd5b60006020828403121561071f57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105e1576105e1610726565b60006020828403121561076157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161079057610790610726565b5060010190565b80820281158282048414176105e1576105e1610726565b6000826107cb57634e487b7160e01b600052601260045260246000fd5b500490565b805169ffffffffffffffffffff811681146107ea57600080fd5b919050565b600080600080600060a0868803121561080757600080fd5b610810866107d0565b9450602086015193506040860151925060608601519150610833608087016107d0565b90509295509295909350565b80820260008212600160ff1b8414161561085b5761085b610726565b81810583148215176105e1576105e161072656fea2646970667358221220ae867c3a7e087d20851b18de9ea6ef7435bb7c2a7f4e6c2d28b0c0a5e4152e4264736f6c63430008130033000000000000000000000000694aa1769357215de4fac081bf1f309adc325306",
"nonce": "0x3",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [],
"libraries": [],
"pending": [],
"returns": {
"0": {
"internal_type": "contract FundMe",
"value": "0xF6A14438979D42eDFE772927CDc447a250c202cb"
}
},
"timestamp": 1726128433,
"chain": 11155111,
"commit": "f338b79"
}
53 changes: 53 additions & 0 deletions broadcast/DeployFundMe.s.sol/11155111/run-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"transactions": [
{
"hash": "0x988e2faddc135913078f4507511bfe421fa128620d92d593fb538252ca4273db",
"transactionType": "CREATE",
"contractName": "FundMe",
"contractAddress": "0xe6f845235a3c6135fc8f72a74672dfb772c7c858",
"function": null,
"arguments": [
"0x694AA1769357215DE4FAC081bf1f309aDC325306"
],
"transaction": {
"from": "0x1cd8804d7efe697410df6d73e362bd72b77e92ea",
"gas": "0xb0144",
"value": "0x0",
"input": "0x60a060405234801561001057600080fd5b5060405161095638038061095683398101604081905261002f91610058565b33608052600280546001600160a01b0319166001600160a01b0392909216919091179055610088565b60006020828403121561006a57600080fd5b81516001600160a01b038116811461008157600080fd5b9392505050565b6080516108a56100b160003960008181610134015281816102fa015261044101526108a56000f3fe60806040526004361061007f5760003560e01c8063893d20e81161004e578063893d20e814610125578063b60d42881461008e578063be2693f01461016c578063d7b4750c146101815761008e565b80630343fb25146100965780630d8e6e2c146100df5780633ccfd60b146100f45780636b69a592146101095761008e565b3661008e5761008c6101a1565b005b61008c6101a1565b3480156100a257600080fd5b506100cc6100b13660046106e4565b6001600160a01b031660009081526020819052604090205490565b6040519081526020015b60405180910390f35b3480156100eb57600080fd5b506100cc61027c565b34801561010057600080fd5b5061008c6102ef565b34801561011557600080fd5b506100cc674563918244f4000081565b34801561013157600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016100d6565b34801561017857600080fd5b5061008c610436565b34801561018d57600080fd5b5061015461019c36600461070d565b61057f565b600254674563918244f40000906101c29034906001600160a01b03166105af565b10156102155760405162461bcd60e51b815260206004820152601b60248201527f596f75206e65656420746f207370656e64206d6f72652045544821000000000060448201526064015b60405180910390fd5b336000908152602081905260408120805434929061023490849061073c565b90915550506001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b03191633179055565b6002546040805163054fd4d560e41b815290516000926001600160a01b0316916354fd4d509160048083019260209291908290030181865afa1580156102c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ea919061074f565b905090565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103385760405163579610db60e01b815260040160405180910390fd5b60005b60015481101561038e5760006001828154811061035a5761035a610768565b60009182526020808320909101546001600160a01b03168252819052604081205550806103868161077e565b91505061033b565b5060408051600081526020810191829052516103ac9160019161066a565b50604051600090339047908381818185875af1925050503d80600081146103ef576040519150601f19603f3d011682016040523d82523d6000602084013e6103f4565b606091505b50509050806104335760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b604482015260640161020c565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461047f5760405163579610db60e01b815260040160405180910390fd5b60015460005b818110156104d6576000600182815481106104a2576104a2610768565b60009182526020808320909101546001600160a01b03168252819052604081205550806104ce8161077e565b915050610485565b5060408051600081526020810191829052516104f49160019161066a565b50604051600090339047908381818185875af1925050503d8060008114610537576040519150601f19603f3d011682016040523d82523d6000602084013e61053c565b606091505b505090508061057b5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b604482015260640161020c565b5050565b60006001828154811061059457610594610768565b6000918252602090912001546001600160a01b031692915050565b6000806105bb836105e7565b90506000670de0b6b3a76400006105d28684610797565b6105dc91906107ae565b925050505b92915050565b600080826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610628573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064c91906107ef565b505050915050806402540be400610663919061083f565b9392505050565b8280548282559060005260206000209081019282156106bf579160200282015b828111156106bf57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061068a565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b6000602082840312156106f657600080fd5b81356001600160a01b038116811461066357600080fd5b60006020828403121561071f57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105e1576105e1610726565b60006020828403121561076157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161079057610790610726565b5060010190565b80820281158282048414176105e1576105e1610726565b6000826107cb57634e487b7160e01b600052601260045260246000fd5b500490565b805169ffffffffffffffffffff811681146107ea57600080fd5b919050565b600080600080600060a0868803121561080757600080fd5b610810866107d0565b9450602086015193506040860151925060608601519150610833608087016107d0565b90509295509295909350565b80820260008212600160ff1b8414161561085b5761085b610726565b81810583148215176105e1576105e161072656fea2646970667358221220ae867c3a7e087d20851b18de9ea6ef7435bb7c2a7f4e6c2d28b0c0a5e4152e4264736f6c63430008130033000000000000000000000000694aa1769357215de4fac081bf1f309adc325306",
"nonce": "0x5",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0xcb7a5a",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"transactionHash": "0x988e2faddc135913078f4507511bfe421fa128620d92d593fb538252ca4273db",
"transactionIndex": "0x7d",
"blockHash": "0x6b69bf7f5feae01a35344e5cd9b7522f86144ea6ff4f7b1fa3ea0f5f41fdaf21",
"blockNumber": "0x65e3ab",
"gasUsed": "0x87721",
"effectiveGasPrice": "0xb3efef83e",
"from": "0x1cd8804d7efe697410df6d73e362bd72b77e92ea",
"to": null,
"contractAddress": "0xe6f845235a3c6135fc8f72a74672dfb772c7c858"
}
],
"libraries": [],
"pending": [],
"returns": {
"0": {
"internal_type": "contract FundMe",
"value": "0xE6f845235a3C6135fC8f72a74672DFB772c7C858"
}
},
"timestamp": 1726139620,
"chain": 11155111,
"commit": "f338b79"
}
Loading

0 comments on commit 957fb1c

Please sign in to comment.