Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v3.0.3 #201

Merged
merged 20 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
29 changes: 1 addition & 28 deletions .github/workflows/foundry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,16 @@ jobs:
- ubuntu-latest
architecture:
- "x64"
python-version:
- "3.10"
node_version:
- 16

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}

- name: Install Ape
uses: ApeWorX/[email protected]
with:
python-version: '3.10'

- name: install vyper
run: pip install git+https://github.com/vyperlang/vyper

- name: Compile contracts
# Compile Ape contracts to get dependencies
run: ape compile --force --size


- name: Install Vyper
run: pip install vyper==0.3.7

- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
with:
fetch-depth: 1

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

- name: Set pip cache directory path
id: pip-cache-dir-path
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Ape tests

on:
push:
Expand All @@ -20,12 +20,15 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: ApeWorX/[email protected]
with:
python-version: '3.10'

- name: install vyper
run: pip install git+https://github.com/vyperlang/vyper
- name: install requirements
run: python3 -m pip install -r requirements.txt

- name: install plugins
run: ape plugins install .

- name: Compile contracts
# TODO: Force recompiles until ape compile caching is fixed
run: ape compile --force --size
Expand All @@ -34,7 +37,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'

- name: Install hardhat
run: npm install hardhat
Expand Down
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
[submodule "lib/erc4626-tests"]
path = lib/erc4626-tests
url = https://github.com/a16z/erc4626-tests
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
release = v4.9.5
[submodule "lib/tokenized-strategy"]
path = lib/tokenized-strategy
url = https://github.com/yearn/tokenized-strategy
15 changes: 10 additions & 5 deletions TECH_SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ When deploying a new vault, it requires the following parameters:
- role_manager: account that can assign and revoke Roles
- profit_max_unlock_time: max amount of time profit will be locked before being distributed

All deployment variables besides the `asset` can be updated post deployment.

## Normal Operation

### Deposits / Mints
Expand Down Expand Up @@ -127,11 +129,7 @@ Every role can be filled by an EOA, multi-sig or other smart contracts. Each rol

The account that manages roles is a single account, set in `role_manager`.

This role_manager can be an EOA, a multi-sig or a Governance Module that relays calls.

The vault comes with the ability to "open" every role. Meaning that any function that requires the caller to hold that role would be come permsissionless.

The vault imposes no restrictions on the role managers ability to open or close any role. **But this should be done with extreme care as most of the roles are not meant to be opened and can lead to loss of funds if done incorrectly**.
This role_manager can be an EOA, a multi-sig or a Governance contract that relays calls.

### Strategy Management
This responsibility is taken by callers with ADD_STRATEGY_MANAGER, REVOKE_STRATEGY_MANAGER and FORCE_REVOKE_MANAGER roles
Expand Down Expand Up @@ -171,6 +169,13 @@ The vault checks that the `minimumTotalIdle` parameter is respected (i.e. there'

If the strategy has more debt than the max_debt, the vault will request the funds back. These funds may be locked in the strategy, which will result in the strategy returning less funds than requested by the vault.

#### Auto Allocations
The DEBT_MANAGER can set the vaults `auto_allocate` flag to `True`.

This will cause every deposit or mint call to end by the vault pushing as much debt as possible to the first strategy in the queue.

NOTE: Not having at least 1 strategy in the `default_queue` with the `auto_allocate` flag will cause all deposits to revert.

#### Setting maximum debt for a specific strategy
The MAX_DEBT_MANAGER can set the maximum amount of tokens the vault will allow a strategy to owe at any moment in time.

Expand Down
6 changes: 2 additions & 4 deletions ape-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ dependencies:
- name: tokenized-strategy
github: yearn/tokenized-strategy
ref: v3.0.2
contracts_folder: src
config_override:
contracts_folder: src

solidity:
version: 0.8.18
import_remapping:
- "@openzeppelin/contracts=openzeppelin/v4.9.5"
- "@tokenized-strategy=tokenized-strategy/v3.0.2"

ethereum:
local:
Expand Down
Binary file added audits/Yearn V3 report Statemind.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/VaultFactory.vy
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct PFConfig:
fee_recipient: address

# Identifier for this version of the vault.
API_VERSION: constant(String[28]) = "3.0.2"
API_VERSION: constant(String[28]) = "3.0.3"

# The max amount the protocol fee can be set to.
MAX_FEE_BPS: constant(uint16) = 5_000 # 50%
Expand Down
Loading
Loading