Compare commits
No commits in common. "cff92193ec8320ba064ce11bc9c59a8c630949d4" and "54dda02722ad5e861f40197fd7e19dbd23339e82" have entirely different histories.
cff92193ec
...
54dda02722
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -40,6 +40,3 @@
|
|||||||
[submodule "lottery/lib/foundry-devops"]
|
[submodule "lottery/lib/foundry-devops"]
|
||||||
path = lottery/lib/foundry-devops
|
path = lottery/lib/foundry-devops
|
||||||
url = https://github.com/cyfrin/foundry-devops
|
url = https://github.com/cyfrin/foundry-devops
|
||||||
[submodule "soldeer-package-manager/lib/forge-std"]
|
|
||||||
path = soldeer-package-manager/lib/forge-std
|
|
||||||
url = https://github.com/foundry-rs/forge-std
|
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
FOUNDRY_PROFILE: ci
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
strategy:
|
|
||||||
fail-fast: true
|
|
||||||
|
|
||||||
name: Foundry project
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Install Foundry
|
|
||||||
uses: foundry-rs/foundry-toolchain@v1
|
|
||||||
|
|
||||||
- name: Show Forge version
|
|
||||||
run: |
|
|
||||||
forge --version
|
|
||||||
|
|
||||||
- name: Run Forge fmt
|
|
||||||
run: |
|
|
||||||
forge fmt --check
|
|
||||||
id: fmt
|
|
||||||
|
|
||||||
- name: Run Forge build
|
|
||||||
run: |
|
|
||||||
forge build --sizes
|
|
||||||
id: build
|
|
||||||
|
|
||||||
- name: Run Forge tests
|
|
||||||
run: |
|
|
||||||
forge test -vvv
|
|
||||||
id: test
|
|
||||||
18
soldeer-package-manager/.gitignore
vendored
18
soldeer-package-manager/.gitignore
vendored
@ -1,18 +0,0 @@
|
|||||||
# Compiler files
|
|
||||||
cache/
|
|
||||||
out/
|
|
||||||
|
|
||||||
# Ignores development broadcast logs
|
|
||||||
!/broadcast
|
|
||||||
/broadcast/*/31337/
|
|
||||||
/broadcast/**/dry-run/
|
|
||||||
|
|
||||||
# Docs
|
|
||||||
docs/
|
|
||||||
|
|
||||||
# Dotenv file
|
|
||||||
.env
|
|
||||||
|
|
||||||
|
|
||||||
# Soldeer
|
|
||||||
/dependencies
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
## Foundry
|
|
||||||
|
|
||||||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
|
|
||||||
|
|
||||||
Foundry consists of:
|
|
||||||
|
|
||||||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
|
|
||||||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
|
|
||||||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
|
|
||||||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
https://book.getfoundry.sh/
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ forge build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ forge test
|
|
||||||
```
|
|
||||||
|
|
||||||
### Format
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ forge fmt
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gas Snapshots
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ forge snapshot
|
|
||||||
```
|
|
||||||
|
|
||||||
### Anvil
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ anvil
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deploy
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cast
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ cast <subcommand>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Help
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ forge --help
|
|
||||||
$ anvil --help
|
|
||||||
$ cast --help
|
|
||||||
```
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
[profile.default]
|
|
||||||
src = "src"
|
|
||||||
out = "out"
|
|
||||||
libs = ["lib", "dependencies"]
|
|
||||||
remappings = [
|
|
||||||
"@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.0.2/src/",
|
|
||||||
"forge-std/=dependencies/forge-std-1.9.5/src/",
|
|
||||||
]
|
|
||||||
|
|
||||||
[soldeer]
|
|
||||||
remappings_version = false
|
|
||||||
remappings_location = "config"
|
|
||||||
# recursive_deps = true
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
forge-std = "1.9.5"
|
|
||||||
"@openzeppelin-contracts" = "5.0.2"
|
|
||||||
|
|
||||||
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
import {Script, console} from "forge-std/Script.sol";
|
|
||||||
import {Counter} from "../src/Counter.sol";
|
|
||||||
|
|
||||||
contract CounterScript is Script {
|
|
||||||
Counter public counter;
|
|
||||||
|
|
||||||
function setUp() public {}
|
|
||||||
|
|
||||||
function run() public {
|
|
||||||
vm.startBroadcast();
|
|
||||||
|
|
||||||
counter = new Counter();
|
|
||||||
|
|
||||||
vm.stopBroadcast();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
[[dependencies]]
|
|
||||||
name = "@openzeppelin-contracts"
|
|
||||||
version = "5.0.2"
|
|
||||||
url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/5_0_2_14-03-2024_06:11:59_contracts.zip"
|
|
||||||
checksum = "8bc4f0acc7c187771b878d46f7de4bfad1acad2eb5d096d9d05d34035853f5c3"
|
|
||||||
integrity = "55881f6114aa36158566ef52b486d9d96b217c3e47d0e24bbd4994a8cfb5ee7c"
|
|
||||||
|
|
||||||
[[dependencies]]
|
|
||||||
name = "forge-std"
|
|
||||||
version = "1.9.5"
|
|
||||||
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_9_5_21-12-2024_15:04:05_forge-std-1.9.zip"
|
|
||||||
checksum = "57ada736f383289db77fac4472d48f820e7c98172cf9b01681b0c37065ce043f"
|
|
||||||
integrity = "4753ffdfa0dde40878372b6a4d8e8fd1648b190b33996896c8b92f6f1680850f"
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
contract Counter {
|
|
||||||
uint256 public number;
|
|
||||||
|
|
||||||
function setNumber(uint256 newNumber) public {
|
|
||||||
number = newNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
function increment() public {
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
import {Test, console} from "forge-std/Test.sol";
|
|
||||||
import {Counter} from "../src/Counter.sol";
|
|
||||||
|
|
||||||
contract CounterTest is Test {
|
|
||||||
Counter public counter;
|
|
||||||
|
|
||||||
function setUp() public {
|
|
||||||
counter = new Counter();
|
|
||||||
counter.setNumber(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_Increment() public {
|
|
||||||
counter.increment();
|
|
||||||
assertEq(counter.number(), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testFuzz_SetNumber(uint256 x) public {
|
|
||||||
counter.setNumber(x);
|
|
||||||
assertEq(counter.number(), x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user