Skip to content

Commit

Permalink
⚙️ updates
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Dec 3, 2022
1 parent bd1684c commit 7a52e78
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GreeterTest:testSetGm() (gas: 107402)
GreeterTest:testSetGm() (gas: 107432)
61 changes: 61 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Getting Started

This is a guide to get you started with [refcell/femplate](https://github.com/refcell/femplate).

### Installing

Click [`use this template`](https://github.com/refcell/femplate/generate) to create a new repository with this repo as the initial state.

Or, if your repo already exists, run:
```sh
forge init --template https://github.com/refcell/femplate
git submodule update --init --recursive
forge install
```

Run `./utils/rename.sh` to rename all instances of `femplate` with the name of your project/repository.


### First time with Forge/Foundry?

See the official Foundry installation [instructions](https://github.com/foundry-rs/foundry/blob/master/README.md#installation).

Then, install the [foundry](https://github.com/foundry-rs/foundry) toolchain installer (`foundryup`) with:
```bash
curl -L https://foundry.paradigm.xyz | bash
```

Now that you've installed the `foundryup` binary,
anytime you need to get the latest `forge` or `cast` binaries,
you can run `foundryup`.

So, simply execute:
```bash
foundryup
```

🎉 Foundry is installed! 🎉


### Writing Tests with Foundry

With [Foundry](https://github.com/foundry-rs/foundry), all tests are written in Solidity! 🥳

Create a test file for your contract in the `test/` directory.

For example, [`src/Greeter.sol`](./src/Greeter.sol) has its test file defined in [`./test/Greeter.t.sol`](./test/Greeter.t.sol).

To learn more about writing tests in Solidity for Foundry, reference Rari Capital's [solmate](https://github.com/Rari-Capital/solmate/tree/main/src/test) repository created by [@transmissions11](https://twitter.com/transmissions11).

### Configure Foundry

Using [foundry.toml](./foundry.toml), Foundry is easily configurable.

For a full list of configuration options, see the Foundry [configuration documentation](https://github.com/foundry-rs/foundry/blob/master/config/README.md#all-options).


### That's it!

Now you are all set up to start building your project with femplate!

Navigate back to the [Readme](./README.md) to resume your setup!
105 changes: 22 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,14 @@
<img align="right" width="150" height="150" top="100" src="./assets/readme.jpg">
<img align="right" width="150" height="150" top="100" src="./public/readme.jpg">

# femplate • [![tests](https://github.com/refcell/femplate/actions/workflows/ci.yml/badge.svg?label=tests)](https://github.com/refcell/femplate/actions/workflows/ci.yml) ![license](https://img.shields.io/github/license/refcell/femplate?label=license) ![solidity](https://img.shields.io/badge/solidity-^0.8.15-lightgrey)
# femplate • [![tests](https://github.com/refcell/femplate/actions/workflows/ci.yml/badge.svg?label=tests)](https://github.com/refcell/femplate/actions/workflows/ci.yml) ![license](https://img.shields.io/github/license/refcell/femplate?label=license) ![solidity](https://img.shields.io/badge/solidity-^0.8.17-lightgrey)

A **Clean**, **Robust** Template for Foundry Projects.

## Getting Started
### Usage

Click [`use this template`](https://github.com/refcell/femplate/generate) to create a new repository with this repo as the initial state.
**Building & Testing**

Or, if your repo already exists, run:
```sh
forge init --template https://github.com/refcell/femplate
git submodule update --init --recursive
forge install
```

Run `./utils/rename.sh` to rename all instances of `femplate` with the name of your project/repository.

## Blueprint

```ml
lib
├─ forge-std — https://github.com/foundry-rs/forge-std
├─ solmate — https://github.com/Rari-Capital/solmate
scripts
├─ Deploy.s.sol — Simple Deployment Script
src
├─ Greeter — A Minimal Greeter Contract
test
└─ Greeter.t — Exhaustive Tests
```


## Development

**Setup**
```bash
forge install
```

**Building**
```bash
forge build
```

**Testing**
```bash
forge test
```
Build the foundry project with `forge build`. Then you can run tests with `forge test`.

**Deployment & Verification**

Expand All @@ -60,51 +21,27 @@ _NOTE: These scripts are required to be _executable_ meaning they must be made e
_NOTE: these scripts will prompt you for the contract name and deployed addresses (when verifying). Also, they use the `-i` flag on `forge` to ask for your private key for deployment. This uses silent mode which keeps your private key from being printed to the console (and visible in logs)._


### First time with Forge/Foundry?
### I'm new, how do I get started?

See the official Foundry installation [instructions](https://github.com/foundry-rs/foundry/blob/master/README.md#installation).
We created a guide to get you started with: [GETTING_STARTED.md](./GETTING_STARTED.md).

Then, install the [foundry](https://github.com/foundry-rs/foundry) toolchain installer (`foundryup`) with:
```bash
curl -L https://foundry.paradigm.xyz | bash
```

Now that you've installed the `foundryup` binary,
anytime you need to get the latest `forge` or `cast` binaries,
you can run `foundryup`.
### Blueprint

So, simply execute:
```bash
foundryup
```ml
lib
├─ forge-std — https://github.com/foundry-rs/forge-std
├─ solmate — https://github.com/transmissions11/solmate
scripts
├─ Deploy.s.sol — Example Contract Deployment Script
src
├─ Greeter — Example Contract
test
└─ Greeter.t — Example Contract Tests
```

🎉 Foundry is installed! 🎉


### Writing Tests with Foundry

With [Foundry](https://github.com/foundry-rs/foundry), all tests are written in Solidity! 🥳

Create a test file for your contract in the `test/` directory.

For example, [`src/Greeter.sol`](./src/Greeter.sol) has its test file defined in [`./test/Greeter.t.sol`](./test/Greeter.t.sol).

To learn more about writing tests in Solidity for Foundry, reference Rari Capital's [solmate](https://github.com/Rari-Capital/solmate/tree/main/src/test) repository created by [@transmissions11](https://twitter.com/transmissions11).


### Configure Foundry

Using [foundry.toml](./foundry.toml), Foundry is easily configurable.

For a full list of configuration options, see the Foundry [configuration documentation](https://github.com/foundry-rs/foundry/blob/master/config/README.md#all-options).


## License

[AGPL-3.0-only](https://github.com/refcell/femplate/blob/master/LICENSE)


## Acknowledgements
### Notable Mentions

- [femplate](https://github.com/refcell/femplate)
- [foundry](https://github.com/foundry-rs/foundry)
Expand All @@ -114,6 +51,8 @@ For a full list of configuration options, see the Foundry [configuration documen
- [foundry-toolchain](https://github.com/foundry-rs/foundry-toolchain)


## Disclaimer
### Disclaimer

_These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk._

See [LICENSE](./LICENSE) for more details.
10 changes: 1 addition & 9 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
# Default definitions: https://github.com/gakonst/foundry/blob/b7917fa8491aedda4dd6db53fbb206ea233cd531/config/src/lib.rs#L782
# See more config options at: https://github.com/gakonst/foundry/tree/master/config

# The Default Profile
[profile.default]
solc_version = '0.8.15'
solc_version = '0.8.17'
auto_detect_solc = false
optimizer_runs = 1_000

[fuzz]
runs = 1_000

# Extreme Fuzzing CI Profile :P
[profile.fuzz.ci]
runs = 100_000
File renamed without changes
4 changes: 2 additions & 2 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.15;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {Script} from 'forge-std/Script.sol';

Expand Down
4 changes: 2 additions & 2 deletions src/Greeter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.15;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ERC20 } from "solmate/tokens/ERC20.sol";

Expand Down
4 changes: 2 additions & 2 deletions test/Greeter.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.15;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "forge-std/Test.sol";

Expand Down

0 comments on commit 7a52e78

Please sign in to comment.