Skip to content

Commit 2beb233

Browse files
movsiienkoopencode
andauthored
refactor: use foundry instead of hardhat (#8)
Co-authored-by: opencode <noreply@opencode.ai>
1 parent 6b4f3b6 commit 2beb233

33 files changed

Lines changed: 1236 additions & 12279 deletions

.github/workflows/ci.yml

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# .github/workflows/ci.yml
22

3-
name: Hardhat PR Check
3+
name: Foundry PR Check
44

55
on:
66
pull_request:
@@ -16,67 +16,52 @@ concurrency:
1616

1717
jobs:
1818
build-and-test:
19-
name: Build & Test (Node ${{ matrix.node-version }})
19+
name: Build & Test
2020
runs-on: ubuntu-latest
2121

22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
node-version: [22]
2622
env:
23+
CI: true
2724
POLYGON_MAINNET_RPC_URL: ${{ secrets.POLYGON_MAINNET_RPC_URL }}
2825
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
29-
KMS_KEY_ID: ${{ secrets.KMS_KEY_ID }}
26+
AWS_KMS_KEY_ID: ${{ secrets.KMS_KEY_ID }}
3027
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
3128

3229
steps:
3330
- name: Checkout Repository
3431
uses: actions/checkout@v4
3532
with:
36-
fetch-depth: 0
37-
- name: Setup Node.js ${{ matrix.node-version }}
38-
uses: actions/setup-node@v4
39-
with:
40-
node-version: ${{ matrix.node-version }}
41-
cache: "npm"
42-
43-
- name: Install Dependencies
44-
run: npm ci
45-
46-
- name: Lint Code
47-
run: npm run lint
48-
49-
- name: Check Formatting
50-
run: npm run format:check
33+
submodules: recursive
34+
fetch-depth: 0 # Need full history for reference builds
5135

52-
- name: Compile Contracts
53-
run: npx hardhat compile
54-
55-
- name: Type Check
56-
run: npm run typecheck
57-
58-
- name: Hardhat tests
59-
run: npx hardhat test
60-
env:
61-
CI: true
36+
- name: Install Just
37+
uses: extractions/setup-just@v2
6238

63-
- name: Upload Coverage Artifact
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: coverage-report-node-${{ matrix.node-version }}
67-
path: ./coverage/
68-
if-no-files-found: warn
39+
- name: Install Foundry
40+
uses: foundry-rs/foundry-toolchain@v1
6941

7042
- name: Configure AWS Credentials
7143
uses: aws-actions/configure-aws-credentials@v4
7244
with:
7345
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
7446
aws-region: "us-east-1"
7547

76-
- name: Upgrade vMahout
77-
run: |
78-
npx hardhat upgrade-vmahout --network polygon --proxy 0x724d3E7e0da94DF12793F7Fbce46388C293C572E --minter 0x9bA70DA0Fcc5619C80b817276eBb94a4b59b2D18
48+
- name: Build Reference Contracts
49+
run: just build-reference
7950

80-
- name: Upgrade PropertyDataConsensus
51+
- name: Run build and checks
52+
run: just check
53+
54+
- name: Get KMS Address
8155
run: |
82-
npx hardhat upgradeConsensus --network polygon --proxy 0x9bA70DA0Fcc5619C80b817276eBb94a4b59b2D18
56+
echo "KMS_ADDRESS=$(cast wallet address --aws)" >> $GITHUB_ENV
57+
58+
- name: Upgrade PropertyDataConsensus (Dry Run)
59+
run: just upgrade-consensus-prod polygon
60+
env:
61+
CONSENSUS_PROXY: "0x9bA70DA0Fcc5619C80b817276eBb94a4b59b2D18"
62+
63+
- name: Upgrade vMahout (Dry Run)
64+
run: just upgrade-vmahout-prod polygon
65+
env:
66+
VMAHOUT_PROXY: "0x724d3E7e0da94DF12793F7Fbce46388C293C572E"
67+
MINTER_ADDRESS: "0x9bA70DA0Fcc5619C80b817276eBb94a4b59b2D18"

.github/workflows/grant-roles.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,20 @@ jobs:
5353
with:
5454
fetch-depth: 0
5555

56-
- name: Setup Node.js
57-
uses: actions/setup-node@v4
58-
with:
59-
node-version: "22.x"
60-
cache: "npm"
56+
- name: Install Just
57+
uses: extractions/setup-just@v2
58+
59+
- name: Install Foundry
60+
uses: foundry-rs/foundry-toolchain@v1
6161

6262
- name: Configure AWS Credentials
6363
uses: aws-actions/configure-aws-credentials@v4
6464
with:
6565
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
6666
aws-region: "us-east-1"
6767

68-
- name: Install Dependencies
69-
run: npm ci
70-
71-
- name: Compile Contracts
72-
run: npx hardhat compile
68+
- name: Build Contracts
69+
run: just build
7370

7471
- name: Grant LEXICON_ORACLE_MANAGER_ROLE
7572
run: |
@@ -78,7 +75,7 @@ jobs:
7875
echo "Recipient: ${{ inputs.recipient }}"
7976
echo "Executed by: ${{ github.actor }}"
8077
81-
npx hardhat grantLexiconOracleManager \
82-
--network ${{ inputs.network }} \
83-
--proxy ${{ inputs.proxy }} \
84-
--recipient ${{ inputs.recipient }}
78+
just grant-roles ${{ inputs.network }}
79+
env:
80+
CONSENSUS_PROXY: ${{ inputs.proxy }}
81+
RECIPIENT_ADDRESS: ${{ inputs.recipient }}

.github/workflows/release.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main]
66

7-
# Permissions required for OIDC and checking out code
87
permissions:
98
contents: read
109
id-token: write
@@ -15,39 +14,50 @@ jobs:
1514
runs-on: ubuntu-latest
1615

1716
env:
17+
CI: true
1818
POLYGON_MAINNET_RPC_URL: ${{ secrets.POLYGON_MAINNET_RPC_URL }}
1919
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
20-
KMS_KEY_ID: ${{ secrets.RELEASE_KMS_KEY_ID }}
20+
AWS_KMS_KEY_ID: ${{ secrets.RELEASE_KMS_KEY_ID }}
2121
AWS_ROLE_TO_ASSUME: ${{ secrets.RELEASE_ROLE }}
2222

2323
steps:
2424
- name: Checkout Repository
2525
uses: actions/checkout@v4
2626
with:
27-
fetch-depth: 0
27+
submodules: recursive
28+
fetch-depth: 0 # Need full history for reference builds
2829

29-
- name: Setup Node.js
30-
uses: actions/setup-node@v4
30+
- name: Install Just
31+
uses: extractions/setup-just@v2
32+
33+
- name: Install Foundry
34+
uses: foundry-rs/foundry-toolchain@v1
3135
with:
32-
node-version: "22.x"
33-
cache: "npm"
36+
version: nightly
3437

3538
- name: Configure AWS Credentials
3639
uses: aws-actions/configure-aws-credentials@v4
3740
with:
3841
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
3942
aws-region: "us-east-1"
4043

41-
- name: Install Dependencies
42-
run: npm ci
44+
- name: Build Reference Contracts
45+
run: just build-reference
4346

44-
- name: Compile Contracts
45-
run: npx hardhat compile
47+
- name: Build Contracts
48+
run: just build
4649

47-
- name: Upgrade
50+
- name: Get KMS Address
4851
run: |
49-
npx hardhat upgrade-vmahout --network polygon --proxy 0x3b3ad74fF6840fA5Ff5E65b551fC5E8ed13c3F18 --minter 0x525E59e4DE2B51f52B9e30745a513E407652AB7c
52+
echo "KMS_ADDRESS=$(cast wallet address --aws)" >> $GITHUB_ENV
5053
5154
- name: Upgrade PropertyDataConsensus
52-
run: |
53-
npx hardhat upgradeConsensus --network polygon --proxy 0x525E59e4DE2B51f52B9e30745a513E407652AB7c
55+
run: just upgrade-consensus-prod polygon
56+
env:
57+
CONSENSUS_PROXY: "0x525E59e4DE2B51f52B9e30745a513E407652AB7c"
58+
59+
- name: Upgrade vMahout
60+
run: just upgrade-vmahout-prod polygon
61+
env:
62+
VMAHOUT_PROXY: "0x3b3ad74fF6840fA5Ff5E65b551fC5E8ed13c3F18"
63+
MINTER_ADDRESS: "0x525E59e4DE2B51f52B9e30745a513E407652AB7c"

.gitignore

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
node_modules
2-
.env
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
# Ignores development broadcast logs
6+
!/broadcast
7+
/broadcast/*/31337/
8+
/broadcast/**/dry-run/
39

4-
# Hardhat files
5-
/cache
6-
/artifacts
10+
# Docs
11+
docs/
712

8-
# TypeChain files
9-
/typechain
10-
/typechain-types
13+
# Dotenv file
14+
.env
1115

12-
# solidity-coverage files
13-
/coverage
14-
/coverage.json
1516

16-
# Hardhat Ignition default folder for deployments against a local node
17-
ignition/deployments/chain-31337
17+
previous-builds/

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
7+
[submodule "lib/openzeppelin-contracts-upgradeable"]
8+
path = lib/openzeppelin-contracts-upgradeable
9+
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
10+
[submodule "lib/openzeppelin-foundry-upgrades"]
11+
path = lib/openzeppelin-foundry-upgrades
12+
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades

.prettierrc

Lines changed: 0 additions & 15 deletions
This file was deleted.

.solhint.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)