Skip to content

Commit 0ccd586

Browse files
committed
first commit
0 parents  commit 0ccd586

24 files changed

+807
-0
lines changed

.gas-snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FundMeTest:testWithdrawWithOwner() (gas: 104736)

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
FOUNDRY_PROFILE: ci
10+
11+
jobs:
12+
check:
13+
strategy:
14+
fail-fast: true
15+
16+
name: Foundry project
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
23+
- name: Install Foundry
24+
uses: foundry-rs/foundry-toolchain@v1
25+
with:
26+
version: nightly
27+
28+
- name: Show Forge version
29+
run: |
30+
forge --version
31+
32+
- name: Run Forge fmt
33+
run: |
34+
forge fmt --check
35+
id: fmt
36+
37+
- name: Run Forge build
38+
run: |
39+
forge build --sizes
40+
id: build
41+
42+
- name: Run Forge tests
43+
run: |
44+
forge test -vvv
45+
id: test

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
# Ignores development broadcast logs
6+
!/broadcast
7+
/broadcast/*/31337/
8+
/broadcast/**/dry-run/
9+
10+
# Docs
11+
docs/
12+
13+
# Dotenv file
14+
.env

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "lib/chainlink-brownie-contracts"]
2+
path = lib/chainlink-brownie-contracts
3+
url = https://github.com/smartcontractkit/chainlink-brownie-contracts
4+
[submodule "lib/foundry-devops"]
5+
path = lib/foundry-devops
6+
url = https://github.com/Cyfrin/foundry-devops

.prettierrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"endOfLine": "auto",
5+
"printWidth": 120,
6+
"singleQuote": false,
7+
"tabWidth": 2,
8+
"trailingComma": "all",
9+
"overrides": [
10+
{
11+
"files": "*.sol",
12+
"options": {
13+
"tabWidth": 4
14+
}
15+
}
16+
]
17+
}
18+
19+

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-include .env
2+
3+
build:; forge build
4+
5+
deploy-op_sepolia:
6+
forge script script/DeployFundMe.s.sol:DeployFundMe --rpc-url $(OP_SEPOLIA_RPC_URL) --broadcast --private-key $(PRIVATE_KEY) --verify --etherscan-api-key $(OP_ETHERSCAN_API_KEY) -vvvv
7+
8+
deploy-sepolia:
9+
forge script script/DeployFundMe.s.sol:DeployFundMe --rpc-url $(SEPOLIA_PRC_URL) --broadcast --private-key $(PRIVATE_KEY) --verify --etherscan-api-key $(ETHERSCAN_API_KEY) -vvvv
10+
11+
12+

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
## Foundry
2+
3+
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
4+
5+
Foundry consists of:
6+
7+
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
8+
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
9+
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
10+
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
11+
12+
## Documentation
13+
14+
https://book.getfoundry.sh/
15+
16+
## Usage
17+
18+
### Build
19+
20+
```shell
21+
$ forge build
22+
```
23+
24+
### Test
25+
26+
```shell
27+
$ forge test
28+
```
29+
30+
### Format
31+
32+
```shell
33+
$ forge fmt
34+
```
35+
36+
### Gas Snapshots
37+
38+
```shell
39+
$ forge snapshot
40+
```
41+
42+
### Anvil
43+
44+
```shell
45+
$ anvil
46+
```
47+
48+
### Deploy
49+
50+
```shell
51+
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
52+
```
53+
54+
### Cast
55+
56+
```shell
57+
$ cast <subcommand>
58+
```
59+
60+
### Help
61+
62+
```shell
63+
$ forge --help
64+
$ anvil --help
65+
$ cast --help
66+
```
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"transactions": [
3+
{
4+
"hash": "0x5719c5c1bfe911cd06a3cfac42cf840739a3a81150e16ff3dacc4bc9d42cc1be",
5+
"transactionType": "CREATE",
6+
"contractName": "MockV3Aggregator",
7+
"contractAddress": "0x85536f1fd99fc37b2bf8f42709fd8a5daa2e51c8",
8+
"function": null,
9+
"arguments": [
10+
"8",
11+
"200000000000"
12+
],
13+
"transaction": {
14+
"from": "0x0c3743ac31156269ea0ea04bdb1864645017a92b",
15+
"gas": "0x8f6a0",
16+
"value": "0x0",
17+
"input": "0x608060405234801561001057600080fd5b5060405161056138038061056183398101604081905261002f916100a4565b6000805460ff191660ff84161790556100478161004e565b50506100ff565b60018190554260025560038054906000610067836100d8565b9091555050600380546000908152600460209081526040808320949094558254825260058152838220429081905592548252600690529190912055565b600080604083850312156100b757600080fd5b825160ff811681146100c857600080fd5b6020939093015192949293505050565b6000600182016100f857634e487b7160e01b600052601160045260246000fd5b5060010190565b6104538061010e6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638205bf6a116100715780638205bf6a146101775780639a6fc8f514610180578063a87a20ce146101fe578063b5ab58dc14610211578063b633620c14610231578063feaf968c1461025157600080fd5b8063313ce567146100b95780634aa2011f146100dd57806350d25bcd1461013a57806354fd4d5014610151578063668a0f02146101595780637284e41614610162575b600080fd5b6000546100c69060ff1681565b60405160ff90911681526020015b60405180910390f35b6101386100eb366004610311565b69ffffffffffffffffffff90931660038181556001849055600283905560009182526004602090815260408084209590955581548352600581528483209390935554815260069091522055565b005b61014360015481565b6040519081526020016100d4565b610143600481565b61014360035481565b61016a61027c565b6040516100d4919061034a565b61014360025481565b6101c761018e366004610398565b69ffffffffffffffffffff8116600090815260046020908152604080832054600683528184205460059093529220549293919290918490565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100d4565b61013861020c3660046103ba565b61029c565b61014361021f3660046103ba565b60046020526000908152604090205481565b61014361023f3660046103ba565b60056020526000908152604090205481565b60035460008181526004602090815260408083205460068352818420546005909352922054836101c7565b60606040518060600160405280602381526020016103fb60239139905090565b600181905542600255600380549060006102b5836103d3565b9091555050600380546000908152600460209081526040808320949094558254825260058152838220429081905592548252600690529190912055565b803569ffffffffffffffffffff8116811461030c57600080fd5b919050565b6000806000806080858703121561032757600080fd5b610330856102f2565b966020860135965060408601359560600135945092505050565b602081526000825180602084015260005b81811015610378576020818601810151604086840101520161035b565b506000604082850101526040601f19601f83011684010191505092915050565b6000602082840312156103aa57600080fd5b6103b3826102f2565b9392505050565b6000602082840312156103cc57600080fd5b5035919050565b6000600182016103f357634e487b7160e01b600052601160045260246000fd5b506001019056fe76302e362f746573742f6d6f636b2f4d6f636b563341676772656761746f722e736f6ca2646970667358221220172d36456dc307b3b2f93da3dd50f59b970f9f934891b6bb74f7a91407701a2a64736f6c634300081c003300000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000002e90edd000",
18+
"nonce": "0x5f",
19+
"chainId": "0xaa36a7"
20+
},
21+
"additionalContracts": [],
22+
"isFixedGasLimit": false
23+
},
24+
{
25+
"hash": "0x6bd7ca98348c34a9c7cc3626732be53d28df08b7b6a50506f844b5aad5f34812",
26+
"transactionType": "CREATE",
27+
"contractName": "FundMe",
28+
"contractAddress": "0x8b64d0dd246881b2cf4635b2b1260da2c8257590",
29+
"function": null,
30+
"arguments": [
31+
"0x85536f1FD99fC37B2Bf8f42709fD8A5daa2e51C8"
32+
],
33+
"transaction": {
34+
"from": "0x0c3743ac31156269ea0ea04bdb1864645017a92b",
35+
"gas": "0xa2be5",
36+
"value": "0x0",
37+
"input": "0x6080604052348015600f57600080fd5b50604051610814380380610814833981016040819052602c91605e565b60038054336001600160a01b031991821617909155600480549091166001600160a01b0392909216919091179055608c565b600060208284031215606f57600080fd5b81516001600160a01b0381168114608557600080fd5b9392505050565b6107798061009b6000396000f3fe60806040526004361061007f5760003560e01c8063893d20e81161004e578063893d20e814610125578063b60d42881461008e578063d7b4750c14610157578063dc0d3dff146101775761008e565b80630343fb25146100965780630d8e6e2c146100df5780633ccfd60b146100f45780636b69a592146101095761008e565b3661008e5761008c610197565b005b61008c610197565b3480156100a257600080fd5b506100cc6100b13660046105cf565b6001600160a01b031660009081526020819052604090205490565b6040519081526020015b60405180910390f35b3480156100eb57600080fd5b506100cc6102a3565b34801561010057600080fd5b5061008c610321565b34801561011557600080fd5b506100cc674563918244f4000081565b34801561013157600080fd5b506003546001600160a01b03165b6040516001600160a01b0390911681526020016100d6565b34801561016357600080fd5b5061013f6101723660046105f8565b610440565b34801561018357600080fd5b5061013f6101923660046105f8565b610470565b600454674563918244f40000906101b89034906001600160a01b031661049a565b101561020b5760405162461bcd60e51b815260206004820152601b60248201527f596f75206e65656420746f207370656e64206d6f72652045544821000000000060448201526064015b60405180910390fd5b336000908152602081905260408120805434929061022a908490610627565b90915550503360009081526001602052604090205460ff166102a1576002805460018181019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b031916339081179091556000908152602082905260409020805460ff191690911790555b565b6000600460009054906101000a90046001600160a01b03166001600160a01b03166354fd4d506040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031c919061063a565b905090565b6003546001600160a01b0316331461034c576040516330cd747160e01b815260040160405180910390fd5b60005b6002548110156103985760006002828154811061036e5761036e610653565b60009182526020808320909101546001600160a01b0316825281905260408120555060010161034f565b5060408051600081526020810191829052516103b691600291610555565b50604051600090339047908381818185875af1925050503d80600081146103f9576040519150601f19603f3d011682016040523d82523d6000602084013e6103fe565b606091505b505090508061043d5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610202565b50565b60006002828154811061045557610455610653565b6000918252602090912001546001600160a01b031692915050565b6002818154811061048057600080fd5b6000918252602090912001546001600160a01b0316905081565b6000806104a6836104d2565b90506000670de0b6b3a76400006104bd8684610669565b6104c79190610680565b925050505b92915050565b600080826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610513573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053791906106c1565b505050915050806402540be40061054e9190610713565b9392505050565b8280548282559060005260206000209081019282156105aa579160200282015b828111156105aa57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610575565b506105b69291506105ba565b5090565b5b808211156105b657600081556001016105bb565b6000602082840312156105e157600080fd5b81356001600160a01b038116811461054e57600080fd5b60006020828403121561060a57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104cc576104cc610611565b60006020828403121561064c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176104cc576104cc610611565b60008261069d57634e487b7160e01b600052601260045260246000fd5b500490565b805169ffffffffffffffffffff811681146106bc57600080fd5b919050565b600080600080600060a086880312156106d957600080fd5b6106e2866106a2565b60208701516040880151606089015192975090955093509150610707608087016106a2565b90509295509295909350565b80820260008212600160ff1b8414161561072f5761072f610611565b81810583148215176104cc576104cc61061156fea2646970667358221220d0a2853e72487f71a994fe36be78007bb8f7eebc039cdfa604bca7215c51ed6664736f6c634300081c003300000000000000000000000085536f1fd99fc37b2bf8f42709fd8a5daa2e51c8",
38+
"nonce": "0x60",
39+
"chainId": "0xaa36a7"
40+
},
41+
"additionalContracts": [],
42+
"isFixedGasLimit": false
43+
}
44+
],
45+
"receipts": [
46+
{
47+
"status": "0x1",
48+
"cumulativeGasUsed": "0x10c8e52",
49+
"logs": [],
50+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
51+
"type": "0x2",
52+
"transactionHash": "0x5719c5c1bfe911cd06a3cfac42cf840739a3a81150e16ff3dacc4bc9d42cc1be",
53+
"transactionIndex": "0x5c",
54+
"blockHash": "0x0daf53c6c950fd072bfe77453902dacb10dba5a2400ba461cbfb330c7e6cf907",
55+
"blockNumber": "0x69cf64",
56+
"gasUsed": "0x6e575",
57+
"effectiveGasPrice": "0x2316c66d",
58+
"from": "0x0c3743ac31156269ea0ea04bdb1864645017a92b",
59+
"to": null,
60+
"contractAddress": "0x85536f1fd99fc37b2bf8f42709fd8a5daa2e51c8"
61+
},
62+
{
63+
"status": "0x1",
64+
"cumulativeGasUsed": "0x11461d5",
65+
"logs": [],
66+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
67+
"type": "0x2",
68+
"transactionHash": "0x6bd7ca98348c34a9c7cc3626732be53d28df08b7b6a50506f844b5aad5f34812",
69+
"transactionIndex": "0x5d",
70+
"blockHash": "0x0daf53c6c950fd072bfe77453902dacb10dba5a2400ba461cbfb330c7e6cf907",
71+
"blockNumber": "0x69cf64",
72+
"gasUsed": "0x7d383",
73+
"effectiveGasPrice": "0x2316c66d",
74+
"from": "0x0c3743ac31156269ea0ea04bdb1864645017a92b",
75+
"to": null,
76+
"contractAddress": "0x8b64d0dd246881b2cf4635b2b1260da2c8257590"
77+
}
78+
],
79+
"libraries": [],
80+
"pending": [],
81+
"returns": {
82+
"0": {
83+
"internal_type": "contract FundMe",
84+
"value": "0x8B64D0dd246881B2Cf4635b2B1260Da2c8257590"
85+
}
86+
},
87+
"timestamp": 1729753898,
88+
"chain": 11155111,
89+
"commit": null
90+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"transactions": [
3+
{
4+
"hash": "0x3de966e642673a4dc483137e6cbd708249392b8d4ef53fc48eceed868dfbaa08",
5+
"transactionType": "CREATE",
6+
"contractName": "FundMe",
7+
"contractAddress": "0x68c68051bc6335cdbaf5a8dd6da25bdac8509cb7",
8+
"function": null,
9+
"arguments": null,
10+
"transaction": {
11+
"from": "0x0c3743ac31156269ea0ea04bdb1864645017a92b",
12+
"gas": "0x92ca4",
13+
"value": "0x0",
14+
"input": "0x6080604052348015600f57600080fd5b50600280546001600160a01b03191633179055610701806100316000396000f3fe6080604052600436106100745760003560e01c80636b69a5921161004e5780636b69a592146100f5578063b60d428814610083578063dba6335f14610111578063dc0d3dff1461014957610083565b80630d8e6e2c1461008b5780633ccfd60b146100b35780633e47d6f3146100c857610083565b3661008357610081610169565b005b610081610169565b34801561009757600080fd5b506100a0610235565b6040519081526020015b60405180910390f35b3480156100bf57600080fd5b506100816102b7565b3480156100d457600080fd5b506100a06100e336600461054a565b60006020819052908152604090205481565b34801561010157600080fd5b506100a0674563918244f4000081565b34801561011d57600080fd5b50600254610131906001600160a01b031681565b6040516001600160a01b0390911681526020016100aa565b34801561015557600080fd5b5061013161016436600461057a565b6103d6565b674563918244f4000061017b34610400565b10156101ce5760405162461bcd60e51b815260206004820152601b60248201527f596f75206e65656420746f207370656e64206d6f72652045544821000000000060448201526064015b60405180910390fd5b33600090815260208190526040812080543492906101ed9084906105a9565b90915550506001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b03191633179055565b60008073694aa1769357215de4fac081bf1f309adc3253069050806001600160a01b03166354fd4d506040518163ffffffff1660e01b8152600401602060405180830381865afa15801561028d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b191906105c2565b91505090565b6002546001600160a01b031633146102e2576040516330cd747160e01b815260040160405180910390fd5b60005b60015481101561032e57600060018281548110610304576103046105db565b60009182526020808320909101546001600160a01b031682528190526040812055506001016102e5565b50604080516000815260208101918290525161034c916001916104d0565b50604051600090339047908381818185875af1925050503d806000811461038f576040519150601f19603f3d011682016040523d82523d6000602084013e610394565b606091505b50509050806103d35760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b60448201526064016101c5565b50565b600181815481106103e657600080fd5b6000918252602090912001546001600160a01b0316905081565b60008061040b610434565b90506000670de0b6b3a764000061042285846105f1565b61042c9190610608565b949350505050565b60008073694aa1769357215de4fac081bf1f309adc32530690506000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa15801561048e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b29190610649565b505050915050806402540be4006104c9919061069b565b9250505090565b828054828255906000526020600020908101928215610525579160200282015b8281111561052557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906104f0565b50610531929150610535565b5090565b5b808211156105315760008155600101610536565b60006020828403121561055c57600080fd5b81356001600160a01b038116811461057357600080fd5b9392505050565b60006020828403121561058c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105bc576105bc610593565b92915050565b6000602082840312156105d457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176105bc576105bc610593565b60008261062557634e487b7160e01b600052601260045260246000fd5b500490565b805169ffffffffffffffffffff8116811461064457600080fd5b919050565b600080600080600060a0868803121561066157600080fd5b61066a8661062a565b6020870151604088015160608901519297509095509350915061068f6080870161062a565b90509295509295909350565b80820260008212600160ff1b841416156106b7576106b7610593565b81810583148215176105bc576105bc61059356fea264697066735822122026f6f9733e2fec5ac9bcb0f51f9523eef683eca1e7ce90b1b6d614f195baa7fe64736f6c634300081c0033",
15+
"nonce": "0x24",
16+
"chainId": "0xaa37dc"
17+
},
18+
"additionalContracts": [],
19+
"isFixedGasLimit": false
20+
}
21+
],
22+
"receipts": [
23+
{
24+
"status": "0x1",
25+
"cumulativeGasUsed": "0x7ba4d",
26+
"logs": [],
27+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
28+
"type": "0x2",
29+
"transactionHash": "0x3de966e642673a4dc483137e6cbd708249392b8d4ef53fc48eceed868dfbaa08",
30+
"transactionIndex": "0x1",
31+
"blockHash": "0x0601afb471658e879a1fbca7b73c120525be288a4644d63d65bdd6f5e1ed8eaa",
32+
"blockNumber": "0x11efd9e",
33+
"gasUsed": "0x70f1a",
34+
"effectiveGasPrice": "0xf6a4d",
35+
"from": "0x0c3743ac31156269ea0ea04bdb1864645017a92b",
36+
"to": null,
37+
"contractAddress": "0x68c68051bc6335cdbaf5a8dd6da25bdac8509cb7",
38+
"l1BaseFeeScalar": "0x1db0",
39+
"l1BlobBaseFee": "0x1",
40+
"l1BlobBaseFeeScalar": "0xd2730",
41+
"l1Fee": "0x7fed043f6",
42+
"l1GasPrice": "0xd8a5b97",
43+
"l1GasUsed": "0x4db1"
44+
}
45+
],
46+
"libraries": [],
47+
"pending": [],
48+
"returns": {},
49+
"timestamp": 1729418985,
50+
"chain": 11155420,
51+
"commit": null
52+
}

0 commit comments

Comments
 (0)