Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fp-debt-allocator-o…
Browse files Browse the repository at this point in the history
…ptimizer-helper-update
  • Loading branch information
fp-crypto committed Oct 19, 2024
2 parents e509743 + 148d4e7 commit f882794
Show file tree
Hide file tree
Showing 87 changed files with 9,111 additions and 9,680 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,4 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: pip install -r requirements.txt
- run: black --check --include "(tests|scripts)" .
- uses: wagoid/commitlint-github-action@v5
56 changes: 33 additions & 23 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
name: tests
name: test

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

env:
FOUNDRY_PROFILE: ci

jobs:
tests:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: ApeWorX/[email protected]
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
ape-version-pin: "==0.6.27"
ape-plugins-list: 'solidity==0.6.11 vyper==0.6.13 infura==0.6.5 hardhat==0.6.13 etherscan==0.6.11'

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

- run: ape compile --force --size
- run: npm install hardhat

- run: ape test
timeout-minutes: 40
env:
WEB3_ALCHEMY_PROJECT_ID: ${{ secrets.WEB3_ALCHEMY_PROJECT_ID }}
WEB3_INFURA_PROJECT_ID: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}

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

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv --ffi
id: test
40 changes: 24 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
pyenv.cfg
vyper_git_commithash.txt
bin/
lib/
share/
build/
include/
.build
node_modules
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
/broadcast/

# Docs
docs/

# Dotenv file
.env

node_modules/
.gas-snapshot

yarn.lock
.DS_Store

.vscode

**/__pycache__
.pytest_cache
**/.cache
venv/
.hypothesis/
.idea
.vscode
yarn.lock
env
**/.cache
19 changes: 19 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[submodule "lib/yearn-vaults-v3"]
path = lib/yearn-vaults-v3
url = https://github.com/yearn/yearn-vaults-v3
branch = v3.0.3
[submodule "lib/tokenized-strategy"]
path = lib/tokenized-strategy
url = https://github.com/yearn/tokenized-strategy
branch = v3.0.3
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = v4.9.5
[submodule "lib/tokenized-strategy-periphery"]
path = lib/tokenized-strategy-periphery
url = https://github.com/yearn/tokenized-strategy-periphery
branch = master
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
9 changes: 8 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.build/
.cache/
venv/
venv/
.build/
.cache/
venv/
lib/
out/
cache/
broadcast/
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-include .env

# deps
update:; forge update
build :; forge build
size :; forge build --sizes

# storage inspection
inspect :; forge inspect ${contract} storage-layout --pretty

# if we want to run only matching tests, set that here
test := test_

# local tests without fork
test :; forge test -vv --ffi
trace :; forge test -vvv --ffi
gas :; forge test --ffi --gas-report
test-contract :; forge test -vv --match-contract $(contract) --ffi
test-contract-gas :; forge test --gas-report --match-contract ${contract} --ffi
trace-contract :; forge test -vvv --match-contract $(contract) --ffi
test-test :; forge test -vv --match-test $(test) --ffi
test-test-trace :; forge test -vvv --match-test $(test) --ffi
trace-test :; forge test -vvvvv --match-test $(test) --ffi
snapshot :; forge snapshot -vv --ffi
snapshot-diff :; forge snapshot --diff -vv --ffi
trace-setup :; forge test -vvvv --ffi
trace-max :; forge test -vvvvv --ffi
coverage :; forge coverage --ffi
coverage-report :; forge coverage --report lcov --ffi
coverage-debug :; forge coverage --report debug --ffi


clean :; forge clean
45 changes: 12 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,25 @@
## How to start

### Requirements
Python >=3.8.0, <=3.10
Yarn
Node.js >=14
Hardhat

### Fork this repository

git clone https://github.com/user/tokenized-strategy-ape-mix
- First you will need to install [Foundry](https://book.getfoundry.sh/getting-started/installation).
NOTE: If you are on a windows machine it is recommended to use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)

cd tokenized-strategy-ape-mix
### Fork this repository

### Set up your virtual environment
```sh
git clone --recursive https://github.com/yearn/vault-periphery

python3 -m venv venv
cd vault-periphery

source venv/bin/activate
pip install vyper==0.3.7

### Install Ape and all dependencies
make build

pip install -r requirements.txt

yarn

ape plugins install .

ape compile

ape test

make test
```
### Deployment

Deployment of periphery contracts such as the [Registry Factory](https://github.com/yearn/vault-periphery/blob/master/contracts/registry/RegistryFactory.sol) or [Address Provider](https://github.com/yearn/vault-periphery/blob/master/contracts/AddressProvider.vy) are done using a create2 factory in order to get a deterministic address that is the same on each EVM chain.

This can be done permissionlessly if the most recent contract has not yet been deployed on a chain you would like to use it on.
Deployment of periphery contracts are done using a create2 factory in order to get a deterministic address that is the same on each EVM chain.

1. [Add an Ape account](https://docs.apeworx.io/ape/stable/commands/accounts.html)
2. Run the deployment the contracts specific deployment script under `scripts/`
```sh
ape run scripts/deploy_contract_name.py --network YOUR_RPC_URL
```
- For chains that don't support 1559 tx's you may need to add a `type="0x0"` argument at the end of the deployment tx.
- ie `tx = deployer_contract.deployCreate2(salt, init_code, sender=deployer, type="0x0")`
3. The address the contract was deployed at will print in the console and should match any other chain the same version has been deployed on.
This can be done permissionlessly if the most recent contract has not yet been deployed on a chain you would like to use it on using this repo https://github.com/wavey0x/yearn-v3-deployer
52 changes: 0 additions & 52 deletions ape-config.yaml

This file was deleted.

Loading

0 comments on commit f882794

Please sign in to comment.