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

Fixes for the immunify bounty + instant exit #1

Merged
merged 50 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
415bc78
feat: remove deposit_for
0xtekgrinder Mar 14, 2024
6214329
feat: emergency_withdrawal inside veANGLE
0xtekgrinder Mar 15, 2024
56247d9
feat: fixture to be able to deploy and use veANGLE
0xtekgrinder Mar 15, 2024
884b4f5
feat: balanceOf now search for previous timestamp instead of reverting
0xtekgrinder Mar 18, 2024
b3447ce
fix: compile errors for new version of veANGLE
0xtekgrinder Mar 18, 2024
0c7ecc3
feat: remove the constructor from veANGLE
0xtekgrinder Mar 21, 2024
fad028d
feat: add back the deposit_for for the veANGLE contract
0xtekgrinder Mar 21, 2024
667b466
feat: chaneg the old veANGLE to the deployed version
0xtekgrinder Mar 21, 2024
2131b5a
feat: withdraw fast now remove the lock and makes all non view functi…
0xtekgrinder Mar 21, 2024
2057b20
fix: veANGLE now compiles with some syntax fixes
0xtekgrinder Mar 22, 2024
1e74df9
tests: emergency withdrawal
0xtekgrinder Mar 22, 2024
80299a3
feat: remove via_ir from compilation
0xtekgrinder Mar 22, 2024
0190f9b
style: prettier contracts
0xtekgrinder Mar 22, 2024
81035f8
chore: less strict linting
0xtekgrinder Mar 22, 2024
c7ae7c0
tests: unit tests for balanceOf
0xtekgrinder Mar 22, 2024
90cda1b
tests: add invariants setup
0xtekgrinder Mar 22, 2024
7c1380f
tests: add invariant working tests
0xtekgrinder Mar 25, 2024
ed86816
chore: update foundry.toml for invariants
0xtekgrinder Mar 25, 2024
ba9dec7
refacotr: update solidity version
0xtekgrinder Mar 25, 2024
18af9a9
chore: remove --sizes check in ci
0xtekgrinder Mar 25, 2024
854b654
chore: install vyper in ci
0xtekgrinder Mar 25, 2024
5dded85
chore: use correct python version to install vyper
0xtekgrinder Mar 25, 2024
13cee93
chore: try more verbose for unit tests
0xtekgrinder Mar 25, 2024
cd55d1b
feat: remove all unused files
0xtekgrinder Mar 28, 2024
10b2cd8
style: fix solhint warnings
0xtekgrinder Mar 28, 2024
1399271
feat: add back some interfaces
0xtekgrinder Mar 28, 2024
5fcb527
chore: switch to fsolidity version 0.8.22 and use via_ir
0xtekgrinder Mar 28, 2024
d6f439b
feat: remove Simulate script
0xtekgrinder Mar 28, 2024
391856c
feat: use private angle-sdk
0xtekgrinder Mar 28, 2024
1004839
chore: update CI to install sdk
0xtekgrinder Mar 28, 2024
01701aa
tests: add more unit tests regarding withdraw_fast
0xtekgrinder Mar 28, 2024
15b2b8c
feat: add areason when reverting when no emergency
0xtekgrinder Mar 28, 2024
91de576
chore: update solidity version in vscode settings
0xtekgrinder Mar 28, 2024
7de5b50
chore: newline in .npmrc
0xtekgrinder Mar 28, 2024
66c955c
style: format IStableMaster
0xtekgrinder Mar 28, 2024
7191028
chore: update utils dependency
0xtekgrinder Mar 28, 2024
51a0117
feat: DeployVeAngle script
0xtekgrinder Mar 28, 2024
481299f
feat: vyper deployer with arguments use vyper
0xtekgrinder Mar 28, 2024
42b435e
refactor: remove BasicScript
0xtekgrinder Mar 28, 2024
1ab6280
feat: add fuzz tests for emergencyWithdrawal
0xtekgrinder Mar 28, 2024
8bf18c4
tests: assertEq in invariants tests
0xtekgrinder Mar 28, 2024
23bbcf1
doc: update README.md
0xtekgrinder Mar 28, 2024
3b4d76d
doc: explain how to upgrade veANGLE
0xtekgrinder Mar 28, 2024
6685b42
tests: fix invariants tests for balanceOf
0xtekgrinder Apr 4, 2024
f7680c9
fix: fuzz tests now doesn't infinite loop
0xtekgrinder Apr 4, 2024
dae57c9
tests: try to withdraw twice
0xtekgrinder Apr 15, 2024
89a3d6b
fix: script to deploy inherit VyperDeployer
0xtekgrinder Apr 20, 2024
60e1f44
fix: remove reetrancy lock in withdraw_fast
0xtekgrinder Apr 22, 2024
841e12a
chore: upgrade vyper version in CI
0xtekgrinder Apr 25, 2024
f1c7f5a
chore: remove Upgrade doc
0xtekgrinder Apr 25, 2024
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
35 changes: 35 additions & 0 deletions .github/actions/setup-repo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup repo
description: Runs all steps to setup the repo (install node_modules, build, etc...)
inputs:
registry-token:
description: 'PAT to access registries'
runs:
using: 'composite'
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
shell: bash
run: |
echo "::set-output name=dir::$(yarn cache dir)"
echo "::set-output name=version::$(yarn -v)"

- uses: actions/setup-node@v3
with:
node-version: '20'

- uses: actions/cache@v2
id: yarn-cache
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}

key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
shell: bash
run: echo "//npm.pkg.github.com/:_authToken=$GH_REGISTRY_ACCESS_TOKEN" >> .npmrc && yarn install --frozen-lockfile --verbose && rm -f .npmrc
env:
GH_REGISTRY_ACCESS_TOKEN: ${{ inputs.registry-token }}
38 changes: 35 additions & 3 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ jobs:
node-version: 18
cache: "yarn"

- name: Install dependencies
run: yarn install
- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: Run solhint
run: yarn lint:check
Expand All @@ -56,7 +58,12 @@ jobs:
version: nightly

- name: Compile foundry
run: yarn compile --sizes
run: yarn compile

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we remove the size?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be able to compile because it fails as a test is too long


- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: "Cache the build so that it can be re-used by the other jobs"
uses: "actions/cache/save@v3"
Expand All @@ -65,6 +72,7 @@ jobs:
path: |
cache-forge
out
node_modules

- name: "Add build summary"
run: |
Expand All @@ -85,13 +93,21 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: Run Foundry tests
run: yarn test:unit
env:
Expand Down Expand Up @@ -119,13 +135,21 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: Run Foundry tests
run: yarn test:invariant
env:
Expand Down Expand Up @@ -155,13 +179,21 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: Run Foundry tests
run: yarn test:fuzz
env:
Expand Down
50 changes: 47 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ jobs:
node-version: 18
cache: "yarn"

- name: Install dependencies
run: yarn install
- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: Run solhint
run: yarn lint:check
Expand All @@ -44,8 +46,13 @@ jobs:
with:
version: nightly

- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: Compile foundry
run: yarn compile --sizes
run: yarn compile

- name: "Cache the build so that it can be re-used by the other jobs"
uses: "actions/cache/save@v3"
Expand All @@ -54,6 +61,7 @@ jobs:
path: |
cache-forge
out
node_modules

- name: "Add build summary"
run: |
Expand All @@ -74,13 +82,21 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: Run Foundry tests
run: yarn test:unit
env:
Expand Down Expand Up @@ -108,13 +124,21 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: Run Foundry tests
run: yarn test:invariant
env:
Expand Down Expand Up @@ -144,13 +168,21 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: Run Foundry tests
run: npm run test:fuzz
env:
Expand All @@ -176,6 +208,18 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install vyper
run: pip install vyper==0.2.16

- name: "Install lcov"
run: "sudo apt-get install lcov"

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@angleprotocol:registry=https://npm.pkg.github.com
5 changes: 3 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"max-line-length": ["error", 120],
"max-line-length": ["warn", 120],
"avoid-call-value": "warn",
"avoid-low-level-calls": "off",
"avoid-tx-origin": "warn",
Expand All @@ -23,6 +23,7 @@
"no-complex-fallback": "off",
"reason-string": "off",
"func-visibility": ["warn", { "ignoreConstructors": true }],
"explicit-types": ["error","explicit"]
"explicit-types": ["error","explicit"],
"custom-errors": "off"
}
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"solidity.compileUsingRemoteVersion": "0.8.20",
"solidity.compileUsingRemoteVersion": "0.8.22",
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity",
"editor.formatOnSave": true
Expand Down
31 changes: 3 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# <img src=".github/assets/logo.svg" alt="Angle" height="40px"> Angle DAO

[![CI](https://github.com/AngleProtocol/boilerplate/actions/workflows/ci.yml/badge.svg)](https://github.com/AngleProtocol/boilerplate/actions)
[![Coverage](https://codecov.io/gh/AngleProtocol/boilerplate/branch/main/graph/badge.svg)](https://codecov.io/gh/AngleProtocol/boilerplate)

This repository proposes a template that is based on foundry frameworks. It also provides templates for EVM compatible smart contracts (in `./contracts/example`), tests and deployment scripts.
## Overview

This repository contains all the contracts related to the Angle DAO including the angle, veANGLE ... etc.

## Starting

Expand Down Expand Up @@ -119,32 +120,6 @@ yarn hardhat:coverage
yarn foundry:coverage
```

### Simulate

You can simulate your transaction live or in fork mode. For both option you need to
complete the `scripts/foundry/Simulate.s.sol` with your values: address sending the tx,
address caled and the data to give to this address call.

For live simulation

```bash
yarn foundry:simulate
```

For fork simulation

```bash
yarn foundry:fork
yarn foundry:simulate:fork
```

For fork simulation at a given block

```bash
yarn foundry:fork:block ${XXXX}
yarn foundry:simulate:fork
```

### Gas report

```bash
Expand Down
Loading
Loading