Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmihal/state-dehydration
https://github.com/dmihal/state-dehydration
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dmihal/state-dehydration
- Owner: dmihal
- License: mit
- Created: 2024-04-11T18:39:37.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-11T19:31:54.000Z (7 months ago)
- Last Synced: 2024-10-03T10:40:55.264Z (about 1 month ago)
- Language: Solidity
- Size: 101 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Start your next Solidity project with Foundry in secondsA highly scalable foundation focused on DX and best practices
## Features
- Sample contracts
- Basic Greeter contract with an external interface.
- Foundry setup
- Foundry configuration with multiple custom profiles and remappings.
- Deployment scripts
- Sample scripts to deploy contracts on both mainnet and testnet.
- Sample Integration & Unit tests
- Example tests showcasing mocking, assertions and configuration for mainnet forking. As well it includes everything needed in order to check code coverage.
- Linter
- Simple and fast solidity linting thanks to forge fmt.
- Find missing natspec automatically.
- Github workflows CI
- Run all tests and see the coverage as you push your changes.
- Export your Solidity interfaces and contracts as packages, and publish them to NPM.
## Setup
1. Install Foundry by following the instructions from [their repository](https://github.com/foundry-rs/foundry#installation).
2. Copy the `.env.example` file to `.env` and fill in the variables.
3. Install the dependencies by running: `yarn install`. In case there is an error with the commands, run `foundryup` and try them again.
## Build
The default way to build the code is suboptimal but fast, you can run it via:
```bash
yarn build
```
In order to build a more optimized code ([via IR](https://docs.soliditylang.org/en/v0.8.15/ir-breaking-changes.html#solidity-ir-based-codegen-changes)), run:
```bash
yarn build:optimized
```
## Running tests
Unit tests should be isolated from any externalities, while Integration usually run in a fork of the blockchain. In this boilerplate you will find example of both.
In order to run both unit and integration tests, run:
```bash
yarn test
```
In order to just run unit tests, run:
```bash
yarn test:unit
```
In order to run unit tests and run way more fuzzing than usual (5x), run:
```bash
yarn test:unit:deep
```
In order to just run integration tests, run:
```bash
yarn test:integration
```
In order to check your current code coverage, run:
```bash
yarn coverage
```
## Deploy & verify
### Setup
Configure the `.env` variables.
### Sepolia
```bash
yarn deploy:sepolia
```
### Mainnet
```bash
yarn deploy:mainnet
```
The deployments are stored in ./broadcast
See the [Foundry Book for available options](https://book.getfoundry.sh/reference/forge/forge-create.html).
## Export And Publish
Export TypeScript interfaces from Solidity contracts and interfaces providing compatibility with TypeChain. Publish the exported packages to NPM.
To enable this feature, make sure you've set the `NPM_TOKEN` on your org's secrets. Then set the job's conditional to `true`:
```yaml
jobs:
export:
name: Generate Interfaces And Contracts
# Remove the following line if you wish to export your Solidity contracts and interfaces and publish them to NPM
if: true
...
```
Also, remember to update the `package_name` param to your package name:
```yaml
- name: Export Solidity - ${{ matrix.export_type }}
uses: defi-wonderland/solidity-exporter-action@1dbf5371c260add4a354e7a8d3467e5d3b9580b8
with:
# Update package_name with your package name
package_name: "my-cool-project"
...
- name: Publish to NPM - ${{ matrix.export_type }}
# Update `my-cool-project` with your package name
run: cd export/my-cool-project-${{ matrix.export_type }} && npm publish --access public
...
```
You can take a look at our [solidity-exporter-action](https://github.com/defi-wonderland/solidity-exporter-action) repository for more information and usage examples.
## Licensing
The primary license for the boilerplate is MIT, see [`LICENSE`](https://github.com/defi-wonderland/solidity-foundry-boilerplate/blob/main/LICENSE)