diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..465e9e3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test + +on: 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 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + id: build + + - name: Run Forge tests + run: | + forge test -vvv + id: test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..046df68 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..888d42d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/forge-std"] + path = lib/forge-std + url = https://github.com/foundry-rs/forge-std diff --git a/README.md b/README.md index 0eb393f..9b05af6 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,106 @@ -# FresaClub Smart contract implementation. -This readme will go over some of the basics of how to utilize the smart contract written for FresaClub. - - -## Creating a new storefront. -Placeholder - -## Updating Storefront information. -Placeholder - -## Checking a storefront exists. -Placeholder - -## Adding product listing to Storefront. -Placeholder - -## Updating product listing in Storefront. -Placeholder - -## Check a product listing exists. -Placeholder - -## Get product listing count from Storefront. -Placeholder - - -## Get product listing from Storefront -Placeholder - - -## Get total number of stores on Fresa network. -Placeholder - - -## Purchase items -Placeholder - - - +# FresaClub Smart contract implementation. +This readme will go over some of the basics of how to utilize the smart contract written for FresaClub. + + +## Creating a new storefront. +Placeholder + +## Updating Storefront information. +Placeholder + +## Checking a storefront exists. +Placeholder + +## Adding product listing to Storefront. +Placeholder + +## Updating product listing in Storefront. +Placeholder + +## Check a product listing exists. +Placeholder + +## Get product listing count from Storefront. +Placeholder + + +## Get product listing from Storefront +Placeholder + + +## Get total number of stores on Fresa network. +Placeholder + + +## Purchase items +Placeholder + + +## 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 --private-key +``` + +### Cast + +```shell +$ cast +``` + +### Help + +```shell +$ forge --help +$ anvil --help +$ cast --help +``` + -- IndieBlocks \ No newline at end of file diff --git a/foundry.toml b/foundry.toml new file mode 100644 index 0000000..25b918f --- /dev/null +++ b/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] + +# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/lib/forge-std b/lib/forge-std new file mode 160000 index 0000000..155d547 --- /dev/null +++ b/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 155d547c449afa8715f538d69454b83944117811 diff --git a/script/Counter.s.sol b/script/Counter.s.sol new file mode 100644 index 0000000..bbc5bb8 --- /dev/null +++ b/script/Counter.s.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Script, console2} from "forge-std/Script.sol"; + +contract FresaClubScript is Script { + function setUp() public {} + + function run() public { + vm.broadcast(); + } +} diff --git a/FresaClub.sol b/src/FresaClub.sol similarity index 100% rename from FresaClub.sol rename to src/FresaClub.sol diff --git a/test/Counter.t.sol b/test/Counter.t.sol new file mode 100644 index 0000000..2ea671e --- /dev/null +++ b/test/Counter.t.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2} from "forge-std/Test.sol"; +import {Fresaclub} from "../src/FresaClub.sol"; + +contract FresaClubTest is Test { + +}