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

Add convenience scripts and fix deployment issues. #131

Closed
Closed
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
16 changes: 9 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
FOUNDRY_PROFILE: ci

jobs:

foundry-test:
strategy:
fail-fast: true
Expand All @@ -16,15 +17,16 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: List files in the repository
run: |
ls ${{ github.workspace }}

- uses: chill-viking/npm-ci@latest
name: Install NPM Dependencies
ls -R ${{ github.workspace }}
- name: Run install
uses: borales/actions-yarn@v4
with:
working_directory: ${{ github.workspace }}
cmd: install # will run `yarn install` command

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -34,7 +36,7 @@ jobs:
- name: Run Forge build
run: |
forge --version
forge build --sizes
forge build --force --sizes
id: build

- name: Run Forge tests
Expand Down Expand Up @@ -67,4 +69,4 @@ jobs:
- name: Test
uses: ambersun1234/[email protected]
with:
network: hardhat
network: hardhat
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": false
"singleQuote": false,
"bracketSpacing": true
}
16 changes: 8 additions & 8 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.5.8"],
"compiler-version": ["error", ">=0.8.0"],
"const-name-snakecase": "off",
"constructor-syntax": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"not-rely-on-time": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
"reason-string": ["warn", { "maxLength": 64 }]
"reason-string": ["warn", { "maxLength": 64 }],
"no-unused-import": "error",
"no-unused-vars": "error",
"no-inline-assembly": "off",
"avoid-low-level-calls": "off",
"no-global-import": "error",
"prettier/prettier": "error"
}
}
35 changes: 32 additions & 3 deletions GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ The test suite coverage must be kept as close to 100% as possible, enforced in p

Test should use Foundry, unless for some reason js or hardhat are needed (for example, upgrades).

The test function names will follow

```
- test_contextCamel_descriptionOfTheTestCamel
- context = method name, contract or functionality.
```

In some cases unit tests may be insufficient and complementary techniques should be used:

1. Property-based tests (aka. fuzzing) for math-heavy code.
Expand All @@ -40,7 +47,7 @@ Modularity should be pursued, but not at the cost of the above priorities.

For contributors, project guidelines and processes must be documented publicly.

Every method and contract must have Natspec
Every method and contract must have Natspec, using the `///` flavour always.

For users, features must be abundantly documented. Documentation should include answers to common questions, solutions to common problems, and recommendations for critical decisions that the user may face.

Expand Down Expand Up @@ -77,7 +84,7 @@ Pull requests are squash-merged to keep the `main` branch history clean. The tit

We welcome conventional commits, with prefixes the title with "fix:" or "feat:".

Work in progress pull requests should be submitted as Drafts and should not be prefixed with "WIP:".
Work in progress pull requests should be submitted as Drafts and should **not** be prefixed with "WIP:".

Branch names don't matter, and commit messages within a pull request mostly don't matter either, although they can help the review process.

Expand Down Expand Up @@ -120,7 +127,9 @@ In addition to the official Solidity Style Guide we have a number of other conve
interface IERC777 {
```

* Group contracts by functionality within folders if possible.
* Group contracts by functionality within folders if possible.

* Interfaces should go inside the `interface` folder, mirroring the folder structure of the implementations

* Folder names must be lowercase, hyphen separated.

Expand All @@ -134,4 +143,24 @@ In addition to the official Solidity Style Guide we have a number of other conve
ExampleContract.sol
```

* Acronyms should be
* Uppercase all if in contract name (`UUPSUpgradeable`, `IPAsset`)
* Camelcase in properties and function names (`ipAssetId`), except if they are defined otherwise in external contracts or interfaces (`tokenURI`)

* Unchecked arithmetic blocks should contain comments explaining why overflow is guaranteed not to happen. If the reason is immediately apparent from the line above the unchecked block, the comment may be omitted.

* Interfaces should contain methods an events. Structs showing in an interface should be grouped in a library

* Function parameter names will have the **suffix** `_`

* Naming conventions
- Contract: CamelCase (adjectiveNoun)
- Struct (noun)
- Event (past-tense)
- Function Name (verb noun)
- local variable (noun / compound noun)
- Booleans (use `isXXX`)
- `isValid`
- `valid`
- Modifier (prepositionNoun)
- `onlyOwner`
39 changes: 39 additions & 0 deletions broadcast/GrantRole.s.sol/5/run-1697136928.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"transactions": [
{
"hash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"function": "grantRole(bytes32,address)",
"arguments": [
"0x637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9",
"0xB6288e57bf7406B35ab4F70Fd1135E907107e386"
],
"rpc": "https://eth-goerli.g.alchemy.com/v2/7WyRjkZW0XJmt7tb4OqO9YTp5z_iVl-o",
"transaction": {
"type": "0x02",
"from": "0xb6288e57bf7406b35ab4f70fd1135e907107e386",
"to": "0x3b698f6ea479672d5ff21d6bc352a2de477a6c64",
"gas": "0x12f1f",
"value": "0x0",
"data": "0x2f2ff15d637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386",
"nonce": "0x6e",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [],
"libraries": [],
"pending": [
"0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac"
],
"path": "/Users/drmanhattan/Workspace/StoryProtocol/protocol-contracts/broadcast/GrantRole.s.sol/5/run-latest.json",
"returns": {},
"timestamp": 1697136928,
"chain": 5,
"multi": false,
"commit": "5bd60a5"
}
71 changes: 71 additions & 0 deletions broadcast/GrantRole.s.sol/5/run-1697136952.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"transactions": [
{
"hash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"function": "grantRole(bytes32,address)",
"arguments": [
"0x637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9",
"0xB6288e57bf7406B35ab4F70Fd1135E907107e386"
],
"rpc": "https://eth-goerli.g.alchemy.com/v2/7WyRjkZW0XJmt7tb4OqO9YTp5z_iVl-o",
"transaction": {
"type": "0x02",
"from": "0xb6288e57bf7406b35ab4f70fd1135e907107e386",
"to": "0x3b698f6ea479672d5ff21d6bc352a2de477a6c64",
"gas": "0x12f1f",
"value": "0x0",
"data": "0x2f2ff15d637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386",
"nonce": "0x6e",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionIndex": "0x3",
"blockHash": "0xb6635783395aa0162a31ba79c92dccdc4930479e47724210908ce84595b8cba2",
"blockNumber": "0x966095",
"from": "0xB6288e57bf7406B35ab4F70Fd1135E907107e386",
"to": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"cumulativeGasUsed": "0x68a62",
"gasUsed": "0xdb75",
"contractAddress": null,
"logs": [
{
"address": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"topics": [
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d",
"0x637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9",
"0x000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386",
"0x000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386"
],
"data": "0x",
"blockHash": "0xb6635783395aa0162a31ba79c92dccdc4930479e47724210908ce84595b8cba2",
"blockNumber": "0x966095",
"transactionHash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionIndex": "0x3",
"logIndex": "0x3",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00000004008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000002000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000080000000000000000000000000000000000000000000100000000000002010000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb2d05e08"
}
],
"libraries": [],
"pending": [],
"path": "/Users/drmanhattan/Workspace/StoryProtocol/protocol-contracts/broadcast/GrantRole.s.sol/5/run-latest.json",
"returns": {},
"timestamp": 1697136952,
"chain": 5,
"multi": false,
"commit": "5bd60a5"
}
71 changes: 71 additions & 0 deletions broadcast/GrantRole.s.sol/5/run-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"transactions": [
{
"hash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"function": "grantRole(bytes32,address)",
"arguments": [
"0x637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9",
"0xB6288e57bf7406B35ab4F70Fd1135E907107e386"
],
"rpc": "https://eth-goerli.g.alchemy.com/v2/7WyRjkZW0XJmt7tb4OqO9YTp5z_iVl-o",
"transaction": {
"type": "0x02",
"from": "0xb6288e57bf7406b35ab4f70fd1135e907107e386",
"to": "0x3b698f6ea479672d5ff21d6bc352a2de477a6c64",
"gas": "0x12f1f",
"value": "0x0",
"data": "0x2f2ff15d637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386",
"nonce": "0x6e",
"accessList": []
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionIndex": "0x3",
"blockHash": "0xb6635783395aa0162a31ba79c92dccdc4930479e47724210908ce84595b8cba2",
"blockNumber": "0x966095",
"from": "0xB6288e57bf7406B35ab4F70Fd1135E907107e386",
"to": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"cumulativeGasUsed": "0x68a62",
"gasUsed": "0xdb75",
"contractAddress": null,
"logs": [
{
"address": "0x3b698f6Ea479672d5fF21D6bc352a2de477a6c64",
"topics": [
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d",
"0x637821dcee84aabec9c8cf4f6f643013a24ad27fd41511ffd937aea80d8619a9",
"0x000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386",
"0x000000000000000000000000b6288e57bf7406b35ab4f70fd1135e907107e386"
],
"data": "0x",
"blockHash": "0xb6635783395aa0162a31ba79c92dccdc4930479e47724210908ce84595b8cba2",
"blockNumber": "0x966095",
"transactionHash": "0x19986ffc0c641ee380a6e4d049f8f8c75b15f4318e6b6e0961e473d76ec67fac",
"transactionIndex": "0x3",
"logIndex": "0x3",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00000004008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000002000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000080000000000000000000000000000000000000000000100000000000002010000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0xb2d05e08"
}
],
"libraries": [],
"pending": [],
"path": "/Users/drmanhattan/Workspace/StoryProtocol/protocol-contracts/broadcast/GrantRole.s.sol/5/run-latest.json",
"returns": {},
"timestamp": 1697136952,
"chain": 5,
"multi": false,
"commit": "5bd60a5"
}
Loading
Loading