Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fe6e535
feat: progress on univ3
fp-crypto Mar 18, 2022
3ae8430
chore: intersitial
fp-crypto Mar 29, 2022
e6c6ade
feat: solidity 0.8 port
fp-crypto Mar 29, 2022
8a73ff3
feat: univ3 unhedged
fp-crypto Apr 26, 2022
7ba814a
fix: renamed SOLID specific tests and added run_check for dex
16slim Apr 27, 2022
dfba11c
fix: necessary changes to setup the UniV3Joint
16slim Apr 27, 2022
852ceeb
fix: set pool state variable during initialize
16slim Apr 27, 2022
48093e2
fix: add collection call to the burnLP function and couple of return …
16slim Apr 28, 2022
a5e02b8
fix: fixed return values
16slim Apr 28, 2022
1180dc1
fix: fixed call to estimated provider assets from joint
16slim Apr 28, 2022
c707902
chore: included hardhat chain id in eth addresses
16slim Apr 28, 2022
12619f0
feat: test harvesting to open and close positions
16slim Apr 28, 2022
9b2e9e4
fix: re-use getReward function collecting the owed tokens
16slim Apr 28, 2022
94b2c70
16slim/uni v3 (#29)
16slim Apr 28, 2022
8bddfcd
feat: tests working with usdc-usdt
fp-crypto May 2, 2022
3eb8d28
chore: intersitial
fp-crypto May 3, 2022
e44e281
interstitial
16slim May 4, 2022
ced6088
feat: profitable harvest sceanrio passing
16slim May 4, 2022
8281795
chore: interstitial
fp-crypto May 4, 2022
853746f
Merge branch '16slim/uniV3' into fp-univ3-merge
fp-crypto May 4, 2022
f7c9133
16slim/uniswap v3 (#32)
16slim May 17, 2022
5314eb2
16slim/implement fixes (#34)
16slim May 20, 2022
7ca9702
feat: first draft at harvest and harvest trigger
16slim May 26, 2022
331d0c3
feat: add harvest and harvest triggers for the joints + should end ep…
16slim Jun 1, 2022
8da8817
fix: don't implement harvest trigger here
16slim Jun 1, 2022
1288a65
fix: add callCost paramter
16slim Jun 1, 2022
dc5e6d2
feat: implement launchHarvest state variable
16slim Jun 1, 2022
4d5bb9b
feat: test harvest triggers for joint and providers
16slim Jun 1, 2022
68fe897
feat: necessary changes to use uniswap official library to simulate s…
16slim Jun 7, 2022
81b9dfa
fix: fix type in _initalizeUniV3StablesJoint
16slim Jun 16, 2022
b4d4b2f
fix: use _ prefix instead of new
16slim Jun 16, 2022
18e063e
fix: reverse order swap if
16slim Jun 16, 2022
16728d4
fix: removed swap comment
16slim Jun 16, 2022
32a6967
fix: removed unnecessary allowance revoke
16slim Jun 16, 2022
dd8963f
fix: changed if order in quote
16slim Jun 16, 2022
a7a8a22
fix: remove address injection in swap manually
16slim Jun 16, 2022
856ef93
feat: add setUniPool funciton
16slim Jun 17, 2022
123b48d
feat: get CRV pool index for 2-4 token pools
16slim Jun 17, 2022
9fdce53
Merge pull request #35 from fp-crypto/16slim/operation_triggers
16slim Jun 17, 2022
886f3cf
feat: check base fee in joint contract harvest trigger
16slim Jun 24, 2022
f0c0897
feat: include factory interface
16slim Jun 24, 2022
0efb918
feat: include fee tier in univ3 joint and pool check when setting the…
16slim Jun 24, 2022
1e0a50c
feat: include min amount out in swaps
16slim Jun 24, 2022
40d5166
fix: added _ to internal variable
16slim Jun 24, 2022
bc26c8b
feat: MEV protection for burnLPManually
16slim Jun 24, 2022
18a7196
fix: tests passing with new fixes
16slim Jun 24, 2022
82bd9cd
Merge pull request #36 from fp-crypto/16slim/implement_sec_review
16slim Jun 24, 2022
7d7aac1
feat: add deployed flattened code
16slim Jun 27, 2022
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
28 changes: 13 additions & 15 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ name: Lint
on:
push:
branches:
- master
- develop
- master
- develop
pull_request:

jobs:
solidity:
runs-on: ubuntu-latest

solidity:
runs-on: ubuntu-latest

steps:
steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
Expand All @@ -21,7 +20,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: "12.x"

- name: Set yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -44,10 +43,10 @@ jobs:
- name: Run linter on *.sol and *.json
run: yarn lint:check

commits:
runs-on: ubuntu-latest
commits:
runs-on: ubuntu-latest

steps:
steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
Expand All @@ -56,10 +55,10 @@ jobs:
- name: Run commitlint
uses: wagoid/commitlint-github-action@v2

brownie:
runs-on: ubuntu-latest
brownie:
runs-on: ubuntu-latest

steps:
steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
Expand All @@ -73,7 +72,7 @@ jobs:
- name: Set pip cache directory path
id: pip-cache-dir-path
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "::set-output name=dir::$(pip cache dir)"

- name: Restore pip cache
uses: actions/cache@v2
Expand All @@ -91,5 +90,4 @@ jobs:

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

# TODO: Add Slither Static Analyzer
94 changes: 47 additions & 47 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,66 @@ name: Test
on:
push:
branches:
- master
- develop
- master
- develop
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v1

- name: Cache compiler installations
uses: actions/cache@v2
with:
path: |
~/.solcx
~/.vvm
key: ${{ runner.os }}-compiler-cache
- 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: Setup node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"

- name: Install ganache
run: npm install -g ganache-cli@6.12.1
- name: Install ganache
run: npm install -g ganache-cli@6.12.1

- name: Set up python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- 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: 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: 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: Install python dependencies
run: pip install -r requirements-dev.txt

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

- name: Run Tests
env:
ETHERSCAN_TOKEN: MW5CQA6QK5YMJXP2WP3RA36HM5A7RA1IHA
WEB3_INFURA_PROJECT_ID: b7821200399e4be2b4e5dbdf06fbe85b
run: |
brownie test tests/test_migration.py --network ftm-main-fork
brownie test tests/test_operation.py --network ftm-main-fork
brownie test tests/test_loss.py --network ftm-main-fork
brownie test tests/test_joint_migration2.py --network ftm-main-fork
- name: Run Tests
env:
ETHERSCAN_TOKEN: MW5CQA6QK5YMJXP2WP3RA36HM5A7RA1IHA
WEB3_INFURA_PROJECT_ID: b7821200399e4be2b4e5dbdf06fbe85b
run: |
brownie test tests/test_migration.py --network ftm-main-fork
brownie test tests/test_operation.py --network ftm-main-fork
brownie test tests/test_loss.py --network ftm-main-fork
brownie test tests/test_joint_migration2.py --network ftm-main-fork
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ node_modules/

# Hardhat
cache

scripts/live_tc.py
scripts/find_pid.py
bin/
lib/
flattened*
pyvenv*
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Read more at
https://hackmd.io/rbPUCp47Sl2dSht6VTaiLg?both


## What you'll find here

- Basic Solidity Smart Contract for creating your own Yearn Strategy ([`contracts/Strategy.sol`](contracts/Strategy.sol))
Expand Down Expand Up @@ -96,14 +95,14 @@ Transaction sent: 0xa70b90eb9a9899e8f6e709c53a436976315b4279c4b6797d0a293e169f94

[`contracts/Strategy.sol`](contracts/Strategy.sol) is where you implement your own logic for your strategy. In particular:

* Create a descriptive name for your strategy via `Strategy.name()`.
* Invest your want tokens via `Strategy.adjustPosition()`.
* Take profits and report losses via `Strategy.prepareReturn()`.
* Unwind enough of your position to payback withdrawals via `Strategy.liquidatePosition()`.
* Unwind all of your positions via `Strategy.exitPosition()`.
* Fill in a way to estimate the total `want` tokens managed by the strategy via `Strategy.estimatedTotalAssets()`.
* Migrate all the positions managed by your strategy via `Strategy.prepareMigration()`.
* Make a list of all position tokens that should be protected against movements via `Strategy.protectedTokens()`.
- Create a descriptive name for your strategy via `Strategy.name()`.
- Invest your want tokens via `Strategy.adjustPosition()`.
- Take profits and report losses via `Strategy.prepareReturn()`.
- Unwind enough of your position to payback withdrawals via `Strategy.liquidatePosition()`.
- Unwind all of your positions via `Strategy.exitPosition()`.
- Fill in a way to estimate the total `want` tokens managed by the strategy via `Strategy.estimatedTotalAssets()`.
- Migrate all the positions managed by your strategy via `Strategy.prepareMigration()`.
- Make a list of all position tokens that should be protected against movements via `Strategy.protectedTokens()`.

## Testing

Expand Down
12 changes: 7 additions & 5 deletions brownie-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ autofetch_sources: True

# require OpenZepplin Contracts
dependencies:
- iearn-finance/yearn-vaults@0.4.3
- OpenZeppelin/openzeppelin-contracts@3.1.0
- storming0x/yearn-vaults@0.4.3-sol8
- OpenZeppelin/openzeppelin-contracts@4.4.1
- 16slim/v3-core@1.0.2-solc-0.8-simulate

# path remapping to support imports from GitHub/NPM
compiler:
solc:
version: 0.6.12
version: 0.8.12
remappings:
- "@yearnvaults=iearn-finance/yearn-vaults@0.4.3"
- "@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.1.0"
- "@yearnvaults=storming0x/yearn-vaults@0.4.3-sol8"
- "@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.4.1"
- "@uniswap=16slim/v3-core@1.0.2-solc-0.8-simulate"

reports:
exclude_contracts:
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = {extends: ["@commitlint/config-conventional"]};
module.exports = { extends: ["@commitlint/config-conventional"] };
2 changes: 1 addition & 1 deletion contracts/AggregatorMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.6.12;
pragma solidity 0.8.12;

contract AggregatorMock {
int256 public price;
Expand Down
Loading