Skip to content

Commit

Permalink
docs (CRC-592): Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
web3skeptic committed Feb 5, 2025
1 parent e35ec6a commit d460d40
Showing 1 changed file with 54 additions and 39 deletions.
93 changes: 54 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,81 @@
## Foundry
# Circles Backing & Factory

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
## Overview

Foundry consists of:
This repository contains smart contracts for Circles Backing and Circles Backing Factory. The Circles Backing contract facilitates the backing of USDC and inflationary Circles (CRC) using Cowswap and Balancer Liquidity Bootstrapping Pools (LBP). The Circles Backing Factory is responsible for deploying Circles Backing instances and managing supported backing assets.

- **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.
## Contracts

## Documentation
### CirclesBacking.sol
- Manages the backing process for inflationary CRC and USDC.
- Interacts with Cowswap for order execution.
- Creates an LBP upon order fulfillment.
- Holds Balancer Pool Tokens (BPT) for one year before allowing the backer to release them.

https://book.getfoundry.sh/
### CirclesBackingFactory.sol
- Deploys new Circles Backing instances.
- Manages supported backing assets and global Balancer Pool Token release.
- Facilitates the creation of LBPs.
- Ensures only `HubV2` human avatars can back their personal CRC.

## Usage
## Getting Started

### Build
### Prerequisites
- Install [Foundry](https://book.getfoundry.sh/) for Solidity development.
- Ensure you have an Ethereum node or use a forked network for testing.

```shell
$ forge build
```
### Installation

### Test
Clone the repository and install dependencies:

```shell
$ forge test
```sh
git clone <repository-url>
cd <project-folder>
forge install
```

### Format

```shell
$ forge fmt
```
### Compilation

### Gas Snapshots
Compile the smart contracts using Foundry:

```shell
$ forge snapshot
```sh
forge build
```

### Anvil
### Running Tests

Before running tests, make sure to set up the `GNOSIS_RPC` environment variable in your `.env` file for forked testing.
Run the test suite with Foundry:

```shell
$ anvil
```sh
forge test
```

### Deploy
To run a specific test:

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

### Cast
### Coverage

```shell
$ cast <subcommand>
To check the test coverage of the project, run the following command:

```sh
forge coverage --no-match-coverage "test|script"
```

### Help
The `--no-match-coverage "test|script"` flag ensures that only relevant files coverage is measured.

## Project Structure

```shell
$ forge --help
$ anvil --help
$ cast --help
```
├── src/ # Smart contract source code
│ ├── CirclesBacking.sol # Circles Backing contract
│ ├── CirclesBackingFactory.sol # Factory contract
├── test/ # Foundry tests
│ ├── CirclesBackingFactory.t.sol # Tests for factory and backing
├── script/ # Deployment scripts
│ ├── Deploy.s.sol # Deployment script for Foundry
└── foundry.toml # Foundry configuration file
```

0 comments on commit d460d40

Please sign in to comment.