Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
YamenMerhi committed Jul 27, 2024
1 parent 9bba319 commit e50883a
Showing 1 changed file with 62 additions and 38 deletions.
100 changes: 62 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,90 @@
## Foundry
# <h1 align="center"> Foundry x Vyper Template </h1>

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
<p align="center"><b>Template repository for getting started quickly with Vyper using a Foundry project</b></p>

Foundry consists of:
## Setup

- **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.
Click **Use this template** on GitHub to create a new repository with this repo as the initial state.

## Documentation
## 🌀 Dependencies

https://book.getfoundry.sh/
You will need the following dependencies:

## Usage
- [Git](https://git-scm.com)
- [Node.js](https://nodejs.org)
- [pnpm](https://pnpm.io)
- [🐍Vyper](https://github.com/vyperlang/vyper)
- [Foundry](https://github.com/foundry-rs/foundry)

### Build
## Installation

```shell
$ forge build
For direct local use, use the following Forge command to create a new project (replace `project` with your project name):

```bash
forge init --template https://github.com/Patronum-Labs/foundry-vyper <project>
```

### Test
## Project Structure

```ml
├── src/
│ └── Greeting.vy # Vyper contract
├── test/
│ └── Greeting.t.sol # Solidity tests for the Vyper contract
├── script/
│ └── Greeting.s.sol # Deployment scripts
├── interfaces/
│ └── IGreeting.sol # Interfaces for the contracts
└── foundry.toml
```shell
$ forge test
```

### Format
### Directory Explanations

```shell
$ forge fmt
```
- **src/:** This is where your Vyper contracts are located.
- **test/:** This is where you write Solidity tests for your Vyper contracts.
- **script/:** This is where you write scripts to deploy your contracts.
- **interfaces/:** This is where you create interfaces for the contracts you want to test or use in scripts.

### Gas Snapshots
## Compiling Vyper Contracts

```shell
$ forge snapshot
To compile a Vyper contract, use the following command:

```bash
vyper src/Greeting.vy
```

### Anvil
Make sure you have Vyper version 0.4.0 or higher:

```shell
$ anvil
```bash
vyper --version
> 0.4.0+commit.e9db8d9
```

### Deploy
## Testing

To run tests, use the following command:

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```bash
forge test
```

### Cast
## Deployment

```shell
$ cast <subcommand>
```
To deploy your contracts using the script, you need to add `PRIVATE_KEY` in the `.env` file.

### Help
Then run the deployment script with the following command (replace `<YOUR_RPC>` with a link to an RPC provider):

```shell
$ forge --help
$ anvil --help
$ cast --help
```bash
forge script script/Greeting.s.sol:GreetingScript --rpc-url <YOUR_RPC> --broadcast
```

## Acknowledgments

This repository is inspired by and uses code from the following projects:

- [pcaversaccio/snekmate](https://github.com/pcaversaccio/snekmate)
- [0xKitsune/Foundry-Vyper](https://github.com/0xKitsune/Foundry-Vyper)
- [foundry-rs/forge-template](https://github.com/foundry-rs/forge-template)

We are grateful to the authors and contributors of these projects for their valuable work and inspiration.

0 comments on commit e50883a

Please sign in to comment.