Skip to content

Commit

Permalink
refacto: full foundry setup (#91)
Browse files Browse the repository at this point in the history
* feat: add disputer contract, scripts and tests

* chore: uniformize hardhat config accounts

* feat: handle infinite approval & format headers

* scripts: skip some chains

* fix: dispute test

* feat: add whitelisted addresses

* fix: deployer address

* chore: deployments

* feat: add set distributor and owner scripts

* feat: add normal deploy Disputer script

* fix: set correctly owner and deployer of disputer

* refactor: revert owner to deployer

* feat: import CoreBorrow contract

* feat: add foundry deploy scripts

* wip: prepare sdk bump

* feat: bump sdk

* feat: add setters to deploy script

* feat: add fund disputer whitelist script

* feat: add mintAgla script

* feat: add deployCreateX script

* feat: update merklDeploy script

* feat: add some control on deployer address and multisig address

* feat: verify createX is deployed

* feat: deploy script improvements

* refactor: create transferInitialFunds function for better readability

* fix: initialize core args

* fix: add missing merkl deployer in funding

* chore: update foundry.toml

* feat: remove CreateX deployment from main script

* feat: add Distributor, DistributorCreator and Disputer scripts

* refactor: improve scripts

* refactor: remove hardhat for foundry

* refactor: clean imports & useless files

* refactor: clean tests

* refactor: minor tests fixes

* ci: remove hardhat

* ci: rename registry-token env

* ci: fix bunfig.toml token

* fix: update bunfig.toml token

* ci: setup repo in coverage job

* feat: verify standard create2 is deployed

* feat: merge puffer token wrapper

* refactor(scripts): add parameterless run functions

* docs(README): add script instructions

* feat: add swell

* fix: foundry.toml swell rpc

* fix: fork test

* refactor: delete TokenLocker.sol

* feat(scripts): add FundDisputer script

* feat(scripts): add Disputer WithdrawFunds script

* refactor(ci): move coverage to separate workflow

* fix: typos

* fix: foundry.toml typo

* chore: bump sdk

* feat(script): add ToggleDispute script

---------

Co-authored-by: picodes <[email protected]>
  • Loading branch information
nlecoufl and Picodes authored Dec 6, 2024
1 parent a702097 commit ddcccb0
Show file tree
Hide file tree
Showing 602 changed files with 13,640,951 additions and 20,358 deletions.
70 changes: 20 additions & 50 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,50 +1,20 @@
## 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_MAINNET=""
#MNEMONIC_MAINNET=""
#MAINNET_ETHERSCAN_API_KEY=""

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

#ETH_NODE_URI_ARBITRUM=""
#MNEMONIC_ARBITRUM=""
#ARBITRUM_ETHERSCAN_API_KEY=""

# DEPLOYER_PRIVATE_KEY=""

# ETH_NODE_URI_MODE=
# ETHERSCAN_API_KEY_MODE=""
# MODE_ETHERSCAN_API_KEY=""

# ETH_NODE_URI_ASTAR=
# ETHERSCAN_API_KEY_ASTAR=""
# MODE_ETHERSCAN_API_ASTAR=""

# ETH_NODE_URI_ASTARZKEVM=
# ETHERSCAN_API_KEY_ASTARZKEVM=""
# MODE_ETHERSCAN_API_ASTARZKEVM=""

#ETH_NODE_URI_ROOTSTOCK=
#ROOTSTOCK_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_TAIKO=
#TAIKO_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_SEI=
#SEI_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_MOONBEAM=
#MOONBEAM_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_SKALE=
#SKALE_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_CELO=
#CELO_ETHERSCAN_API_KEY=""

#ETH_NODE_URI_FRAXTAL=
#FRAXTAL_ETHERSCAN_API_KEY=""

## These are used in foundry.toml

# Global Settings
DEPLOYER_ADDRESS=""
DEPLOYER_PRIVATE_KEY="" # PRIVATE KEY of 0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701
MERKL_DEPLOYER_PRIVATE_KEY="" # PRIVATE KEY of 0x9f76a95AA7535bb0893cf88A146396e00ed21A12
MNEMONIC=""

#HARDHAT_IGNITION_CONFIRM_DEPLOYMENT=false # uncomment to ignore deployments validation
DEPLOY_SALT=""

# Localhost (chainId: X)
LOCALHOST_NODE_URI="http://127.0.0.1:8545"
LOCALHOST_MNEMONIC=""
LOCALHOST_ETHERSCAN_API_KEY=""

# <NETWORK> (chainId: <CHAIN_ID>)
<NETWORK>_NODE_URI=""
<NETWORK>_MNEMONIC=""
<NETWORK>_ETHERSCAN_API_KEY=""
79 changes: 0 additions & 79 deletions .eslintrc.js

This file was deleted.

30 changes: 13 additions & 17 deletions .github/actions/setup-repo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,26 @@ inputs:
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
- uses: oven-sh/setup-bun@v1
with:
node-version: '20'
bun-version: latest

- uses: actions/cache@v2
id: yarn-cache
- uses: actions/cache@v3
id: bun-cache
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-bun-
- 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
run: bun install
env:
GH_REGISTRY_ACCESS_TOKEN: ${{ inputs.registry-token }}
SDK_READ_ACCESS_TOKEN: ${{ inputs.registry-token }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
73 changes: 5 additions & 68 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@ jobs:
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: Install dependencies
run: yarn install
registry-token: ${{ secrets.SDK_READ_ACCESS_TOKEN }}

- name: Run solhint
run: yarn lint:check
run: bun lint

- name: 'Add lint summary'
run: |
Expand All @@ -47,26 +39,14 @@ jobs:
- 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: Install dependencies
run: yarn install --frozen-lockfile

- name: Compile hardhat
run: yarn hardhat:compile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
registry-token: ${{ secrets.SDK_READ_ACCESS_TOKEN }}

- name: Compile foundry
run: yarn foundry:compile --sizes
run: bun foundry:compile --sizes --skip scripts/utils/CreateXConstants.sol

- name: 'Cache the build so that it can be re-used by the other jobs'
uses: 'actions/cache/save@v3'
Expand All @@ -85,44 +65,6 @@ jobs:
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
hardhat-tests:
needs: ['build', 'lint']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: 'Restore the cached build'
uses: 'actions/cache/restore@v3'
with:
fail-on-cache-miss: true
key: 'build-${{ github.sha }}'
path: |
cache-forge
out
cache-hh
artifacts
typechain
node_modules
- run: export NODE_OPTIONS=--max_old_space_size=11264

- name: Run unit tests
run: yarn hardhat:test
env:
ENABLE_GAS_REPORT: true
CI: true
ETH_NODE_URI_ARBITRUM: ${{ secrets.ETH_NODE_URI_ARBITRUM }}

- name: 'Add test summary'
run: |
echo "## Hardhat Unit tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
foundry-tests:
needs: ['build', 'lint']
runs-on: ubuntu-latest
Expand All @@ -131,11 +73,6 @@ jobs:
with:
submodules: 'recursive'

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

- name: 'Restore the cached build'
uses: 'actions/cache/restore@v3'
with:
Expand All @@ -150,7 +87,7 @@ jobs:
node_modules
- name: Run Foundry tests
run: yarn foundry:test
run: bun foundry:test
env:
ETH_NODE_URI_OPTIMISM: ${{ secrets.ETH_NODE_URI_OPTIMISM }}
ETH_NODE_URI_ARBITRUM: ${{ secrets.ETH_NODE_URI_ARBITRUM }}
Expand Down
Loading

0 comments on commit ddcccb0

Please sign in to comment.