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

ci(supplementary-contracts): enable auto format and layout generation #17106

Merged
merged 8 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions .github/workflows/supplementary-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ jobs:
- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies

- name: Check formatting
working-directory: ./packages/supplementary-contracts
run: forge fmt --check

- name: Unit Tests
working-directory: ./packages/supplementary-contracts
run: pnpm clean && pnpm test

- name: Format solidity && update contract layout table
working-directory: ./packages/supplementary-contracts
run: pnpm layout && forge fmt

- name: Commit contract layout table
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "forge fmt & update contract layout table"
17 changes: 17 additions & 0 deletions packages/supplementary-contracts/contract_layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## TokenUnlocking
| Name | Type | Slot | Offset | Bytes | Contract |
|-----------------|-------------|------|--------|-------|------------------------------------------------------------|
| _initialized | uint8 | 0 | 0 | 1 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| _initializing | bool | 0 | 1 | 1 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| __gap | uint256[50] | 1 | 0 | 1600 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| _owner | address | 51 | 0 | 20 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| __gap | uint256[49] | 52 | 0 | 1568 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| _status | uint256 | 101 | 0 | 32 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| __gap | uint256[49] | 102 | 0 | 1568 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| amountVested | uint256 | 151 | 0 | 32 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| amountWithdrawn | uint256 | 152 | 0 | 32 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| recipient | address | 153 | 0 | 20 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| taikoToken | address | 154 | 0 | 20 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| tgeTimestamp | uint64 | 154 | 20 | 8 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |
| __gap | uint256[46] | 155 | 0 | 1472 | contracts/tokenUnlocking/TokenUnlocking.sol:TokenUnlocking |

21 changes: 21 additions & 0 deletions packages/supplementary-contracts/deployments/gen-layouts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Define the list of contracts to inspect
contracts=(
"TokenUnlocking"
)

# Empty the output file initially
output_file="contract_layout.md"
> $output_file

# Loop over each contract
for contract in "${contracts[@]}"; do
# Run forge inspect and append to the file
# Ensure correct concatenation of the command without commas
echo "forge inspect ${contract} storagelayout --pretty >> $output_file"

echo "## ${contract}" >> $output_file
forge inspect ${contract} storagelayout --pretty >> $output_file
echo "" >> $output_file
done
1 change: 1 addition & 0 deletions packages/supplementary-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"clean": "rm -rf abis cache* && forge clean",
"compile": "forge build --build-info --extra-output storage-layout",
"eslint": "pnpm exec eslint --ignore-path .eslintignore --ext .js,.ts .",
"layout": "./deployments/gen-layouts.sh",
"fmt:sol": "forge fmt",
"lint:sol": "forge fmt && pnpm solhint 'contracts/**/*.sol'",
"test": "forge test -vvv --match-path test/*.t.sol"
Expand Down
Loading