Skip to content

Commit

Permalink
chore: set up nix environment
Browse files Browse the repository at this point in the history
  • Loading branch information
fubhy authored Sep 20, 2023
1 parent 5efdb08 commit 9c88323
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 12 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake;
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ jobs:
with:
submodules: recursive

- name: Set up node
uses: actions/setup-node@v3
- name: Set up bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Ignore all dotfiles except the whitelisted ones.
.*
!.env.example
!.envrc
!.github
!.gitignore
!.gitattributes
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif
.RECIPEPREFIX = >

GIT := git
NPX := npx
BUNX := bunx
CAST := cast
FORGE := forge

Expand Down Expand Up @@ -56,7 +56,7 @@ test: ## Run the entire test suite

.PHONY: lint
lint: ## Check linting on all contract source files
> $(NPX) solhint $(CONTRACTS_DIR)/**/*.sol $(TESTS_DIR)/**/*.sol
> $(BUNX) solhint $(CONTRACTS_DIR)/**/*.sol $(TESTS_DIR)/**/*.sol
> $(FORGE) fmt --check $(CONTRACTS_DIR) $(TESTS_DIR)

.PHONY: format
Expand Down
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,38 @@ Enzyme is an Ethereum-based protocol for decentralized on-chain asset management

If you find a vulnerability that may affect live deployments, you can submit a report via:

A. Immunefi(https://immunefi.com/bounty/enzymefinance/), or
A. Immunefi (https://immunefi.com/bounty/enzymefinance/), or

B. Direct email to [[email protected]](mailto:[email protected])

Please **DO NOT** open a public issue.

## Using this Repository

### A Tale of Two Frameworks

:construction:

This repo is currently in-flux for a gradual move from Hardhat to Foundry. All production contracts continue to live in `contracts/persistent/` and `contracts/release/` (deployed contracts [here](https://docs.enzyme.finance/developers/contracts)).
This repository has been migrated from Hardhat to Foundry. All production contracts continue to live in `contracts/persistent/` and `contracts/release/` (deployed contracts [here](https://docs.enzyme.finance/developers/contracts)).

If you are looking for the legacy test suite & test coverage please refer to the [hardhat branch](https://github.com/enzymefinance/protocol/tree/hardhat).

### Prerequisites

Make sure to have the following installed:
#### Automatic

This repository comes with a reproducible development environment based on `nix` and `direnv`.

For the best possible developer experience, make sure you have the following installed:

- [nix](https://nix.dev)
- [direnv](https://direnv.net)

Once you have these installed, your isolated local development environment will be set up automatically whenever you navigate to this directory.

#### Manual

If you don't want to use `nix`, make sure to have the following installed:

- [foundry](https://github.com/foundry-rs/foundry)
- [make](https://www.gnu.org/software/make/)
- [make](https://www.gnu.org/software/make)
- [bun](https://bun.sh)

Then, clone this repository:

Expand Down
110 changes: 110 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
foundry.url = "github:shazow/foundry.nix";
};

outputs = { self, nixpkgs, utils, foundry, ... }:
utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ foundry.overlay ];
};
in {
formatter = pkgs.alejandra;

devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bun
foundry-bin
gnumake
];
};
};
});
}

0 comments on commit 9c88323

Please sign in to comment.