Skip to content

Commit

Permalink
Merge branch 'feat/cellar-architecture' of https://github.com/PeggyJV…
Browse files Browse the repository at this point in the history
…/cellar-contracts into feat/swap-router
  • Loading branch information
crispymangoes committed Jun 17, 2022
2 parents 0ce063e + a322e1d commit 843f3b6
Show file tree
Hide file tree
Showing 11 changed files with 379 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Run Forge tests
run: |
forge test -vvv
forge test -vvv --fork-url https://eth-mainnet.alchemyapi.io/v2/${{ secrets.ALCHEMY_API_KEY }}
id: forge-test

hardhat:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ forge test
npx hardhat test
```

Run tests on forked chains with Foundry:

```bash
forge test --fork-url ALCHEMY_API_KEY
```

Run tests for both Hardhat and Foundry:

```bash
Expand Down
6 changes: 1 addition & 5 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
# Sets the concrete solc version to use
# This overrides the `auto_detect_solc` value
solc_version = '0.8.13'
auto_detect_solc = false

[ci]
# Perform extreme fuzzing on CI runs
fuzz_runs = 100_000
auto_detect_solc = false
10 changes: 5 additions & 5 deletions src/CellarRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ contract CellarRouter is ICellarRouter {
function depositAndSwapIntoCellar(
ERC4626 cellar,
address[] calldata path,
uint256[] calldata poolFees,
uint24[] calldata poolFees,
uint256 assets,
uint256 assetsOutMin,
address receiver
Expand Down Expand Up @@ -131,7 +131,7 @@ contract CellarRouter is ICellarRouter {
function depositAndSwapIntoCellarWithPermit(
ERC4626 cellar,
address[] calldata path,
uint256[] calldata poolFees,
uint24[] calldata poolFees,
uint256 assets,
uint256 assetsOutMin,
address receiver,
Expand Down Expand Up @@ -173,7 +173,7 @@ contract CellarRouter is ICellarRouter {
function withdrawAndSwapFromCellar(
ERC4626 cellar,
address[] calldata path,
uint256[] calldata poolFees,
uint24[] calldata poolFees,
uint256 assets,
uint256 assetsOutMin,
address receiver
Expand Down Expand Up @@ -214,7 +214,7 @@ contract CellarRouter is ICellarRouter {
function withdrawAndSwapFromCellarWithPermit(
ERC4626 cellar,
address[] calldata path,
uint256[] calldata poolFees,
uint24[] calldata poolFees,
uint256 assets,
uint256 assetsOutMin,
address receiver,
Expand Down Expand Up @@ -246,7 +246,7 @@ contract CellarRouter is ICellarRouter {
*/
function _swap(
address[] calldata path,
uint256[] calldata poolFees,
uint24[] calldata poolFees,
uint256 assets,
uint256 assetsOutMin
) internal returns (uint256 assetsOut) {
Expand Down
15 changes: 2 additions & 13 deletions src/SwapRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity 0.8.13;

import { ERC20 } from "@solmate/tokens/ERC20.sol";
import { SafeTransferLib } from "@solmate/utils/SafeTransferLib.sol";
import { IAggregationRouterV4 as AggregationRouterV4 } from "./interfaces/IAggregationRouterV4.sol";
import { IUniswapV2Router02 as UniswapV2Router } from "./interfaces/IUniswapV2Router02.sol";
import { IUniswapV3Router as UniswapV3Router } from "./interfaces/IUniswapV3Router.sol";

Expand Down Expand Up @@ -34,20 +33,10 @@ contract SwapRouter {
UniswapV3Router public immutable uniswapV3Router; // 0xE592427A0AEce92De3Edee1F18E0157C05861564

/**
* @notice 1Inch Dex Aggregation Router
*
*/
AggregationRouterV4 public immutable aggRouterV4; // 0x1111111254fb6c44bAC0beD2854e76F90643097d

/**
* @param _aggRouterV4 1 Inch Router Address
*/
constructor(
AggregationRouterV4 _aggRouterV4,
UniswapV2Router _uniswapV2Router,
UniswapV3Router _uniswapV3Router
) {
constructor(UniswapV2Router _uniswapV2Router, UniswapV3Router _uniswapV3Router) {
//set up all exchanges
aggRouterV4 = _aggRouterV4;
uniswapV2Router = _uniswapV2Router;
uniswapV3Router = _uniswapV3Router;

Expand Down
Loading

0 comments on commit 843f3b6

Please sign in to comment.