Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4cf8ccf
feat: adding sUSD to synths
jmonteer May 25, 2021
573db2b
feat: setup tests
jmonteer May 27, 2021
6973cff
fix: add files
jmonteer May 27, 2021
2347403
feat: tests (WIP)
jmonteer May 27, 2021
998af43
feat: add buffer
jmonteer May 28, 2021
3020cda
fix: add updateBuffer
jmonteer May 28, 2021
aaf38a7
feat: synth tests running
jmonteer May 31, 2021
2b74386
fix: details + test formatting
jmonteer Jun 1, 2021
07ef146
feat: add test_revoke
jmonteer Jun 2, 2021
5738949
feat: test_revoke_with_profit
jmonteer Jun 2, 2021
be1717d
fix: sLINK passing
jmonteer Jun 2, 2021
42d67a5
feat: add test_migrate
jmonteer Jun 2, 2021
23e19d0
feat: clean after each test
jmonteer Jun 2, 2021
ad5ea27
feat: github workflow
jmonteer Jun 2, 2021
4ac97d5
fix: formatting tests
jmonteer Jun 2, 2021
7ea8a79
fix: formatting
jmonteer Jun 2, 2021
1fe44c3
fix: caps
jmonteer Jun 2, 2021
56e56f2
fix: comments
jmonteer Jun 2, 2021
ec10f4f
fix: add comments
jmonteer Jun 2, 2021
d302e5b
fix: formatting
jmonteer Jun 2, 2021
b3eb985
feat: add sEUR testing
jmonteer Jun 2, 2021
135e60d
feat: manualRemoveFullLiquidity returns values
jmonteer Jun 5, 2021
3576548
feat: add withdrawProtection switch
jmonteer Jun 7, 2021
bfcb580
feat: added test for several harvests in a row
jmonteer Jun 7, 2021
adf1444
fix: lint
jmonteer Jun 7, 2021
dd85f89
fix: routes
jmonteer Jun 7, 2021
998cc7e
fix: fix some tests
jmonteer Jun 7, 2021
7530ea9
fix: routes
jmonteer Jun 7, 2021
3db9770
fix: routes
jmonteer Jun 7, 2021
8414d7d
fix: tests
jmonteer Jun 7, 2021
0e2d640
fix: tests
jmonteer Jun 7, 2021
1550c76
fix: formatting
jmonteer Jun 7, 2021
a7c78ce
fix: vault interface
jmonteer Jun 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Lint

on:
push:
branches:
- master
- develop
pull_request:

jobs:

solidity:
runs-on: ubuntu-latest

steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Set yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-

- name: Install node.js dependencies
run: yarn --frozen-lockfile

- name: Run linter on *.sol and *.json
run: yarn lint:check

commits:
runs-on: ubuntu-latest

steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run commitlint
uses: wagoid/commitlint-github-action@v2

brownie:
runs-on: ubuntu-latest

steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Set up python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Set pip cache directory path
id: pip-cache-dir-path
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: Restore pip cache
uses: actions/cache@v2
id: pip-cache
with:
path: |
${{ steps.pip-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
${{ runner.os }}-pip-

- name: Install python dependencies
run: pip install -r requirements-dev.txt

- name: Run black
run: black --check --include "(tests|scripts)" .

# TODO: Add Slither Static Analyzer
65 changes: 65 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on:
push:
branches:
- master
- develop
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache compiler installations
uses: actions/cache@v2
with:
path: |
~/.solcx
~/.vvm
key: ${{ runner.os }}-compiler-cache

- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Install ganache
run: npm install -g [email protected]

- name: Set up python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Set pip cache directory path
id: pip-cache-dir-path
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: Restore pip cache
uses: actions/cache@v2
id: pip-cache
with:
path: |
${{ steps.pip-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
${{ runner.os }}-pip-

- name: Install python dependencies
run: pip install -r requirements-dev.txt

- name: Compile Code
run: brownie compile --size

- name: Run Tests
env:
ETHERSCAN_TOKEN: MW5CQA6QK5YMJXP2WP3RA36HM5A7RA1IHA
WEB3_INFURA_PROJECT_ID: b7821200399e4be2b4e5dbdf06fbe85b
run: |
brownie test -s
Comment thread
jmonteer marked this conversation as resolved.
4 changes: 2 additions & 2 deletions brownie-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ autofetch_sources: True

# require OpenZepplin Contracts
dependencies:
- iearn-finance/[email protected]
- iearn-finance/[email protected]-1
- OpenZeppelin/[email protected]

# path remapping to support imports from GitHub/NPM
compiler:
solc:
version: 0.6.12
remappings:
- "@yearnvaults=iearn-finance/[email protected]"
- "@yearnvaults=iearn-finance/[email protected]-1"
- "@openzeppelin=OpenZeppelin/[email protected]"

reports:
Expand Down
10 changes: 7 additions & 3 deletions contracts/Interfaces/UniswapInterfaces/IUniSimple.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
pragma solidity >=0.6.2;
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;

interface IUniSimple {
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
}
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

interface IUniswapV2Migrator {
Expand Down
11 changes: 9 additions & 2 deletions contracts/Interfaces/UniswapInterfaces/IUniswapV2Router01.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
Expand Down Expand Up @@ -148,7 +149,13 @@ interface IUniswapV2Router01 {
uint256 reserveOut
) external pure returns (uint256 amountIn);

function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);

function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.2;

import "./IUniswapV2Router01.sol";
Expand Down
1 change: 1 addition & 0 deletions contracts/Interfaces/UniswapInterfaces/IWETH.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

interface IUniswapV1Exchange {
Expand All @@ -22,5 +23,8 @@ interface IUniswapV1Exchange {
uint256
) external returns (uint256);

function ethToTokenSwapInput(uint256, uint256) external payable returns (uint256);
function ethToTokenSwapInput(uint256, uint256)
external
payable
returns (uint256);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

interface IUniswapV1Factory {
Expand Down
32 changes: 19 additions & 13 deletions contracts/Interfaces/Yearn/IVaultV2.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IVaultV2 is IERC20 {
struct StrategyParams {
Comment thread
jmonteer marked this conversation as resolved.
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint256 totalDebt;
uint256 totalGain;
uint256 totalLoss;
}

function addStrategy(
address,
uint256,
uint256,
uint256,
uint256
) external;

Expand Down Expand Up @@ -42,6 +54,12 @@ interface IVaultV2 is IERC20 {

function withdraw(uint256 maxShares) external returns (uint256);

function withdraw(
uint256 maxShares,
address receiver,
uint256 maxloss
) external returns (uint256);

function setManagementFee(uint256) external;

function updateStrategyDebtRatio(address, uint256) external;
Expand Down Expand Up @@ -135,15 +153,3 @@ interface IVaultV2 is IERC20 {

function setDepositLimit(uint256) external;
}

struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint256 totalDebt;
uint256 totalGain;
uint256 totalLoss;
}
12 changes: 8 additions & 4 deletions contracts/Interfaces/curve/Curve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
pragma solidity 0.6.12;

interface ICurveFi {
// function coins(int128) external returns (address);

// function underlying_coins(int128) external returns (address);

function coins(uint256) external returns (address);

function underlying_coins(uint256) external returns (address);

function get_virtual_price() external view returns (uint256);

function add_liquidity(
Expand Down Expand Up @@ -44,10 +52,6 @@ interface ICurveFi {
bool use_underlying
) external payable;

function coins(uint256) external returns (address);

function underlying_coins(uint256) external returns (address);

function remove_liquidity_imbalance(
uint256[2] calldata amounts,
uint256 max_burn_amount
Expand Down
7 changes: 5 additions & 2 deletions contracts/Interfaces/erc20/IERC20Extended.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;

interface IERC20Extended{
interface IERC20Extended {
function decimals() external view returns (uint8);

function name() external view returns (string memory);

function symbol() external view returns (string memory);
}
}
14 changes: 14 additions & 0 deletions contracts/Interfaces/synthetix/IAddressResolver.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.4.24;

// https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);

function getSynth(bytes32 key) external view returns (address);

function requireAndGetAddress(bytes32 name, string calldata reason)
external
view
returns (address);
}
Loading