Skip to content

Commit f7d2259

Browse files
feat: update contracts to hayabusa release (#23)
* feat: update contracts to hayabusa release * chore: update gitignore and remove irrelevant files * ci: update workflows * chore: remove metadata files * chore: sync with develop * chore: update yarn.lock * chore: update other packages * fix: deploy script * chore: align with commit 23125cc * chore: update files and add migration data * chore: update yarn lock --------- Co-authored-by: Dan Rusnac <rusnac14@gmail.com>
1 parent 4e0aafe commit f7d2259

282 files changed

Lines changed: 381574 additions & 72924 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.env.example‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
MNEMONIC="denial kitchen pet squirrel other broom bar gas better priority spoil cross" # solo mnemonic with funds
2-
VITE_APP_ENV=local
2+
VITE_APP_ENV=local
3+
4+
# MIXPANEL
5+
VITE_PUBLIC_MIXPANEL_PROJECT_TOKEN="07e09a223dcbe8fbe46d46a908f5b69e"
6+
7+
VITE_MAINTENANCE_MODE=false
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Contracts Formatting
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
- develop
9+
push:
10+
branches:
11+
- main
12+
- develop
13+
14+
jobs:
15+
check-changes:
16+
name: Check Changes in PR
17+
runs-on: ubuntu-latest
18+
outputs:
19+
contracts-changed: ${{ steps.changes.outputs.contracts }}
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Check for changes
25+
id: changes
26+
uses: dorny/paths-filter@v3
27+
with:
28+
filters: |
29+
contracts:
30+
- 'packages/contracts/**'
31+
32+
format-contracts:
33+
name: Format Contracts
34+
runs-on: ubuntu-latest
35+
needs: check-changes
36+
if: needs.check-changes.outputs.contracts-changed == 'true'
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
40+
41+
- name: Use Node v20
42+
uses: actions/setup-node@v3
43+
with:
44+
node-version-file: .nvmrc
45+
cache: "yarn"
46+
47+
- name: Cache node_modules
48+
uses: actions/cache@v3
49+
with:
50+
path: |
51+
node_modules
52+
packages/*/node_modules
53+
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
54+
55+
- name: Install dependencies
56+
run: yarn install --frozen-lockfile
57+
58+
- name: Format Contracts
59+
run: yarn format:contracts
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Thor Integration Testing
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
- develop
9+
push:
10+
branches:
11+
- main
12+
- develop
13+
14+
jobs:
15+
check-changes:
16+
name: Check Changes in PR
17+
runs-on: ubuntu-latest
18+
outputs:
19+
contracts-changed: ${{ steps.changes.outputs.contracts }}
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23+
24+
- name: Check for changes
25+
id: changes
26+
uses: dorny/paths-filter@v3
27+
with:
28+
filters: |
29+
contracts:
30+
- 'packages/contracts/**'
31+
32+
run-contracts-tests:
33+
name: SC Test ${{ matrix.label }}
34+
runs-on: ubuntu-latest
35+
needs: check-changes
36+
if: needs.check-changes.outputs.contracts-changed == 'true'
37+
env:
38+
NODE_OPTIONS: "--max-old-space-size=8192"
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
include:
43+
- shard: shard-i1
44+
label: Protocol Contracts Getters
45+
- shard: shard-i2
46+
label: Stargate Delegation
47+
- shard: shard-i3
48+
label: Stargate Rewards
49+
- shard: shard-i4
50+
label: Boost Maturity Period
51+
- shard: shard-i5
52+
label: Stargate Delegation Status
53+
- shard: shard-i6
54+
label: Node Migration
55+
- shard: shard-i7
56+
label: Stargate Pausing
57+
- shard: shard-i8
58+
label: StargateNFT Upgradeability
59+
- shard: shard-i9
60+
label: Token Manager
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
64+
65+
- name: Use Node v20
66+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
67+
with:
68+
node-version-file: .nvmrc
69+
cache: "yarn"
70+
71+
- name: Cache node_modules
72+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
73+
with:
74+
path: |
75+
node_modules
76+
packages/*/node_modules
77+
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
78+
79+
- name: Cache Solidity compilers
80+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
81+
with:
82+
path: ~/.cache/hardhat-nodejs
83+
key: ${{ runner.os }}-solc-${{ hashFiles('./packages/contracts/hardhat.config.ts') }}
84+
restore-keys: |
85+
${{ runner.os }}-solc-
86+
87+
- name: Install dependencies
88+
run: yarn install --frozen-lockfile
89+
90+
- name: Set shard environment variable
91+
run: echo "SHARD=${{ matrix.shard }}" >> $GITHUB_ENV
92+
93+
- name: Run tests
94+
run: npx dotenv -e .env.example -- yarn contracts:test:integration
95+
96+
97+
run-slither:
98+
name: Slither Analysis
99+
uses: vechain/github-actions/.github/workflows/slither.yaml@72c47d9d8d3f9ed4404f9056f48967e524b43ae9 # v.1.13.0
100+
needs: check-changes
101+
secrets: inherit
102+
if: needs.check-changes.outputs.contracts-changed == 'true'
103+
with:
104+
target: "packages/contracts/"
105+
solc-version: "0.8.20"
106+
ignore-compile: true
107+
fail-on: none
108+
compile-command: 'yarn contracts:compile'
109+
slither-args: '--filter-paths "(openzeppelin|mocks|interfaces|deprecated|templates|NodeManagement/NodeManagementV1.sol|NodeManagement/NodeManagementV2.sol)" --config-file slither.config.json --checklist --json slither.raw.json --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/'

‎.github/workflows/unit-tests.yml‎

Lines changed: 43 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
name: Unit Testing
1+
name: Hardhat Unit Testing
22

33
on:
44
workflow_dispatch:
55
pull_request:
66
branches:
77
- main
8+
- develop
89
push:
910
branches:
1011
- main
12+
- develop
1113

1214
jobs:
1315
check-changes:
@@ -17,11 +19,11 @@ jobs:
1719
contracts-changed: ${{ steps.changes.outputs.contracts }}
1820
steps:
1921
- name: Checkout repository
20-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
22+
uses: actions/checkout@v3
2123

2224
- name: Check for changes
2325
id: changes
24-
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
26+
uses: dorny/paths-filter@v3
2527
with:
2628
filters: |
2729
contracts:
@@ -38,52 +40,43 @@ jobs:
3840
fail-fast: false
3941
matrix:
4042
include:
41-
- shard: shard1000
42-
label: NodeManagement
43-
- shard: shard1001
44-
label: NodeManagementV3
45-
- shard: shard100
46-
label: StargateDel Deployment
47-
- shard: shard101
48-
label: StargateDel Upgradeability
49-
- shard: shard102
50-
label: StargateDel Settings
51-
- shard: shard103
52-
label: StargateDel Delegation
53-
- shard: shard104
54-
label: StargateDel Rewards
55-
- shard: shard105
56-
label: StargateDel NodeManagement
57-
- shard: shard106
58-
label: StargateDel Lost Rewards
59-
- shard: shard1
60-
label: StargateNFT Deployment
61-
- shard: shard2
62-
label: StargateNFT Pausability
63-
- shard: shard3
64-
label: StargateNFT Upgradeability
65-
- shard: shard4
66-
label: StargateNFT Settings
67-
- shard: shard5
43+
- shard: shard-u1
44+
label: Stargate Staking
45+
- shard: shard-u2
46+
label: Stargate Delegation
47+
- shard: shard-u3
48+
label: Stargate Delegation Status
49+
- shard: shard-u4
50+
label: Stargate Rewards
51+
- shard: shard-u5
52+
label: Stargate Pausing
53+
- shard: shard-u6
54+
label: Stargate Clock
55+
- shard: shard-u7
56+
label: Stargate Contracts
57+
- shard: shard-u101
6858
label: StargateNFT Levels
69-
- shard: shard6
70-
label: StargateNFT Compatibility
71-
- shard: shard7
72-
label: StargateNFT Staking
73-
- shard: shard8
74-
label: StargateNFT Stake and Delegate
75-
- shard: shard9
76-
label: StargateNFT Migration
77-
- shard: shard10
78-
label: StargateNFT Whitelisted Migration
79-
- shard: shard11
80-
label: StargateNFT Unstaking
81-
- shard: shard12
82-
label: StargateNFT Base Rewards
83-
- shard: shard13
84-
label: StargateNFT Rewards Auto Claiming
85-
- shard: shard10000
86-
label: Reentrancy Attacks
59+
- shard: shard-u102
60+
label: StargateNFT MintingLogic
61+
- shard: shard-u103
62+
label: StargateNFT Boost
63+
- shard: shard-u104
64+
label: StargateNFT Migrate
65+
- shard: shard-u105
66+
label: StargateNFT Token Manager
67+
- shard: shard-u106
68+
label: StargateNFT Settings
69+
- shard: shard-u107
70+
label: StargateNFT Token
71+
- shard: shard-u108
72+
label: StargateNFT Pausing
73+
- shard: shard-u109
74+
label: StargateNFT Getters
75+
- shard: shard-u110
76+
label: StargateNFT Callback
77+
- shard: shard-u111
78+
label: StargateNFT Initialize
79+
8780
steps:
8881
- name: Checkout repository
8982
uses: actions/checkout@v3
@@ -116,75 +109,5 @@ jobs:
116109
- name: Set shard environment variable
117110
run: echo "SHARD=${{ matrix.shard }}" >> $GITHUB_ENV
118111

119-
- name: Run tests and coverage
120-
run: yarn test:coverage:solidity
121-
122-
- name: Upload coverage
123-
uses: actions/upload-artifact@v4
124-
with:
125-
name: coverage-${{ matrix.shard }}
126-
path: packages/contracts/coverage/coverage-final.json
127-
128-
upload-merged-coverage:
129-
name: Upload Merged Coverage Reports
130-
runs-on: ubuntu-latest
131-
needs: run-contracts-tests
132-
steps:
133-
- name: Checkout repository
134-
uses: actions/checkout@v3
135-
136-
- name: Use Node v20
137-
uses: actions/setup-node@v3
138-
with:
139-
node-version-file: .nvmrc
140-
cache: "yarn"
141-
142-
- name: Cache node_modules
143-
uses: actions/cache@v3
144-
with:
145-
path: |
146-
node_modules
147-
packages/*/node_modules
148-
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
149-
150-
- name: Install dependencies
151-
run: yarn install --frozen-lockfile
152-
153-
- name: Download coverage artifacts
154-
uses: actions/download-artifact@v4
155-
with:
156-
pattern: coverage-*
157-
path: packages/contracts/coverage-shards
158-
159-
- name: Debug downloaded artifacts
160-
run: |
161-
ls -la packages/contracts/coverage-shards
162-
163-
- name: Merge coverage reports
164-
working-directory: packages/contracts
165-
run: npx ts-node scripts/helpers/merge-coverage.ts
166-
167-
- name: Create .nyc_output directory
168-
run: mkdir -p packages/contracts/.nyc_output
169-
170-
- name: Generate final coverage report
171-
working-directory: packages/contracts
172-
run: yarn coverage:report
173-
174-
- name: Upload coverage report to Codecov
175-
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
176-
with:
177-
directory: packages/contracts/coverage/
178-
env:
179-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
180-
181-
# run-slither:
182-
# name: Slither Analysis
183-
# uses: vechain/github-actions/.github/workflows/slither.yaml@fix/slither-edge-cases
184-
# needs: check-changes
185-
# if: needs.check-changes.outputs.contracts-changed == 'true'
186-
# with:
187-
# target: "packages/contracts/"
188-
# solc-version: "0.8.20"
189-
# fail-on: none
190-
# slither-args: '--filter-paths "(openzeppelin|mocks|interfaces|deprecated|templates|NodeManagement/NodeManagementV1.sol|NodeManagement/NodeManagementV2.sol)" --exclude-informational --exclude-optimization --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/'
112+
- name: Run tests
113+
run: npx dotenv -e .env.example -- yarn contracts:test:unit

0 commit comments

Comments
 (0)