Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zikriya committed Jul 29, 2024
2 parents 39be295 + a54efbc commit 342866d
Show file tree
Hide file tree
Showing 106 changed files with 39,185 additions and 1,152 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
package-lock.json
.env
coverage
coverage.json
Expand All @@ -7,6 +8,10 @@ typechain-types
.openzeppelin
Network
#Hardhat files
cache
artifacts
cache
artifacts-zk
cache-zk
deployments-zk
era_test_node.log
.DS_Store
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,52 @@ MultiSwap Overview: >-

# MultiSwap

## Getting Started
Install packages:
```
npm install
```
Add your private key in `.env`, and compile with:
```
hh compile
```
Run unit test:
```
hh test test/FiberRouter.test.ts
```
Run unit test and see coverage with:
```
hh coverage --testfiles "test/FiberRouter.test.ts"
```
The repo is currently undergoing a migration from ethers v5 to v6. The other (older) unit tests (and some scripts) will likely not work, but are kept for reference.

### Deployment to a new network
Before deployment, the necessary configs must be added in `constants/addresses.json`. This includes specifying a router/dex which `FiberRouter` will call and its corresponding selectors:

1. Fetch the ABI of the router/dex you wish to whitelist and paste in `scripts/computeSelectors/main.ts`
2. Run the script with `hh run scripts/computeSelectors/main.ts`
3. From the console output, manually add in the function selectors you wish to whitelist in `constants/addresses.json` (see existing networks for an example)
4. Fill in other required addresses such as the WETH and foundry token address, chainID etc.
5. Now add a network entry in `hardhat.config.ts`. The network names here and in `constants/addresses.json` must match

Contracts are now ready for deployment. Simply run:
```
hh run deploy/index.ts
```
This will deploy all MultiSwap contracts with all necessary configs. Contract addresses will print to console

### ZkSync
ZkSync uses a different compiler with different node packages. After following the 4 steps above, first compile with:
```
hh compile --network zksync
```
Followed by deployment with:
```
hh deploy-zksync --network zksync
```
Note that running the compile command before deploying is necessary. Deployment artifacts (along with deployed contract addresses) can be found in `deployments-zk`

## Overview
### MultiSwap is divided into three major parts
1. Fiber Engine: Controls everything
2. Fiber Router: Everything flows through the router, to ensure that there is no external contract interaction with the Fund Manager contract where the majority of Foundry Assets are.
Expand Down
Loading

0 comments on commit 342866d

Please sign in to comment.