Skip to content

Commit

Permalink
merge pull request #1 from AngleProtocol/feat/migration
Browse files Browse the repository at this point in the history
* feat: add AgTokens, CoreBorrow and FlashLoan

* chore: update solhint config

* chore: upgrade solhint

* chore: remove deployments and e2e tests

* tests: migrate agTokens from hardhat to foundry

* feat: treasury contract

* tests: FlashAngle foundry

* tests: migrate CoreBorrow test to foundry

* refactor: foundry tests are being run tby the ci

* refactor: use package.json from foundry boilerplate

* chore: install foundry dependencies in CI

* chore: add submodules again

* chore: add .gitkeep for invariants and fuzz tests

* tests: add AgTokenSideChainMultiBridge foundry test

* chore: remove hardhat from the repository

* forge install: LayerZero

* chore: add layerZero dependency

* style: prettier and lint files

* chore: comment out invariant and fuzz tests

* feat: AgToken sidechain
  • Loading branch information
0xtekgrinder authored Apr 27, 2024
1 parent 25addd7 commit c136910
Show file tree
Hide file tree
Showing 86 changed files with 10,747 additions and 137 deletions.
26 changes: 26 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Add URI and BIP39 mnemonic, and etherscan API key for every network that you plan to use
## These are used in `hardhat.config.ts` (see `nodeUrl` and `accounts` calls in network definitions)
#ETH_NODE_URI_FORK=""
#MNEMONIC_FORK=""
#ETHERSCAN_API_KEY=""

## To do mainnet fork in Polygon
#ETH_NODE_URI_FORKPOLYGON=""

## To do a local Ethereum mainnet fork
#ETH_NODE_URI_MAINNETFORKREMOTE=""

#ETH_NODE_URI_GOERLI=""
#MNEMONIC_GOERLI=""
#GOERLI_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_MAINNET=""
#MNEMONIC_MAINNET=""
#MAINNET_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_POLYGON=""
#MNEMONIC_POLYGON=""
#POLYGON_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_FANTOM=""

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 }}
14 changes: 14 additions & 0 deletions .github/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 173 additions & 0 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: "CI Deep"

env:
FOUNDRY_PROFILE: "ci"

on:
schedule:
- cron: "0 3 * * 0" # at 3:00am UTC every Sunday
workflow_dispatch:
inputs:
fuzzRuns:
default: "10000"
description: "Unit: number of fuzz runs."
required: false
invariantRuns:
default: "300"
description: "Unit: number of invariant runs."
required: false
invariantDepth:
default: "50"
description: "Unit: invariant depth."
required: false

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

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

- name: Run solhint
run: yarn lint:check

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
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

- name: "Cache the build so that it can be re-used by the other jobs"
uses: "actions/cache/save@v3"
with:
key: "build-${{ github.sha }}"
path: |
cache-forge
out
node_modules
- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test-unit:
needs: ["build", "lint"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"

- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

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

- name: Run Foundry tests
run: yarn test:unit
env:
ETH_NODE_URI_POLYGON: ${{ secrets.ETH_NODE_URI_POLYGON }}
ETH_NODE_URI_ARBITRUM: ${{ secrets.ETH_NODE_URI_ARBITRUM }}
ETH_NODE_URI_OPTIMISM: ${{ secrets.ETH_NODE_URI_OPTIMISM }}
ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}

# test-invariant:
# needs: ["build", "lint"]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: "recursive"
#
# - uses: actions/cache/restore@v3
# with:
# fail-on-cache-miss: true
# path: |
# cache-forge
# out
# node_modules
# key: "build-${{ github.sha }}"
#
# - name: Install Foundry
# uses: foundry-rs/foundry-toolchain@v1
# with:
# version: nightly
#
# - name: Run Foundry tests
# run: yarn test:invariant
# env:
# FOUNDRY_INVARIANT_RUNS: ${{ github.event.inputs.invariantRuns || '300' }}
# FOUNDRY_INVARIANT_DEPTH: ${{ github.event.inputs.invariantDepth || '50' }}
# ETH_NODE_URI_POLYGON: ${{ secrets.ETH_NODE_URI_POLYGON }}
# ETH_NODE_URI_ARBITRUM: ${{ secrets.ETH_NODE_URI_ARBITRUM }}
# ETH_NODE_URI_OPTIMISM: ${{ secrets.ETH_NODE_URI_OPTIMISM }}
# ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}
#
# test-fuzz:
# needs: ["build", "lint"]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: "recursive"
#
# - uses: actions/cache/restore@v3
# with:
# fail-on-cache-miss: true
# path: |
# cache-forge
# out
# node_modules
# key: "build-${{ github.sha }}"
#
# - name: Install Foundry
# uses: foundry-rs/foundry-toolchain@v1
# with:
# version: nightly
#
# - name: Run Foundry tests
# run: yarn test:fuzz
# env:
# FOUNDRY_FUZZ_RUNS: ${{ github.event.inputs.fuzzRuns || '10000' }}
# ETH_NODE_URI_POLYGON: ${{ secrets.ETH_NODE_URI_POLYGON }}
# ETH_NODE_URI_ARBITRUM: ${{ secrets.ETH_NODE_URI_ARBITRUM }}
# ETH_NODE_URI_OPTIMISM: ${{ secrets.ETH_NODE_URI_OPTIMISM }}
# ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}
Loading

0 comments on commit c136910

Please sign in to comment.