Skip to content

Commit 704f9db

Browse files
authored
Merge pull request #29 from ProjectOpenSea/fix/openzeppelin-imports
chore: update OpenZeppelin to v5.5.0 and standardize imports
2 parents 85a6df1 + 1b379ba commit 704f9db

26 files changed

+110
-138
lines changed

.github/workflows/test-ffi.yml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,35 @@ on:
1010
env:
1111
FOUNDRY_PROFILE: ci-ffi
1212

13-
permissions:
14-
contents: write
15-
1613
jobs:
1714
check:
18-
strategy:
19-
fail-fast: true
20-
21-
name: Foundry project
15+
name: Build, Format & Test (FFI)
2216
runs-on: ubuntu-latest
2317
steps:
24-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
2519
with:
26-
ref: ${{ github.head_ref }}
2720
submodules: recursive
2821

2922
- name: Install Foundry
3023
uses: foundry-rs/foundry-toolchain@v1
31-
with:
32-
version: nightly
3324

34-
- name: Run Forge build
35-
run: |
36-
forge --version
37-
forge build --sizes
38-
id: build
25+
- name: Build
26+
run: forge build --sizes
27+
28+
- name: Format check
29+
run: forge fmt --check
3930

40-
- name: Set Up ffi
31+
- name: Set up FFI
4132
run: |
4233
cd ./test-ffi/scripts
4334
yarn install
4435
cd ../tmp
4536
touch temp.json
46-
cd ../..
47-
id: yarn-install
4837
49-
- name: Run Forge tests
50-
run: |
51-
forge test -vvv
52-
id: test
38+
- name: Test
39+
run: forge test -vvv
5340

54-
- name: Clear Temp Files
41+
- name: Clear temp files
5542
run: |
5643
cd ./test-ffi/tmp
5744
find . -maxdepth 1 -name 'temp*' -exec rm -f {} \;
58-
cd ../..
59-
id: clear

.github/workflows/test.yml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,23 @@ on:
1010
env:
1111
FOUNDRY_PROFILE: ci
1212

13-
permissions:
14-
contents: write
15-
1613
jobs:
1714
check:
18-
strategy:
19-
fail-fast: true
20-
21-
name: Foundry project
15+
name: Build, Format & Test
2216
runs-on: ubuntu-latest
2317
steps:
24-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
2519
with:
26-
ref: ${{ github.head_ref }}
2720
submodules: recursive
2821

2922
- name: Install Foundry
3023
uses: foundry-rs/foundry-toolchain@v1
31-
with:
32-
version: nightly
3324

34-
- name: Run Forge build
35-
run: |
36-
forge --version
37-
forge build --sizes
38-
id: build
25+
- name: Build
26+
run: forge build --sizes
3927

40-
- name: Run Forge tests
41-
run: |
42-
forge test -vvv
43-
id: test
28+
- name: Format check
29+
run: forge fmt --check
4430

45-
- name: Lint
46-
run: |
47-
forge fmt
48-
pwd
49-
if [[ `git diff --exit-code` ]]; then
50-
git config --local user.name 'GitHub Actions Bot'
51-
git config --local user.email '<>'
52-
git add .
53-
git commit -m "Github Actions automatically updated formatting with forge fmt"
54-
COMMIT_HASH=$(git rev-parse HEAD)
55-
echo "# Github Actions automatically updated formatting with forge fmt\n$COMMIT_HASH" >> .git-blame-ignore-revs
56-
git add .git-blame-ignore-revs
57-
git commit -m "Updated .git-blame-ignore-revs with commit $COMMIT_HASH"
58-
BRANCH_NAME=$(git symbolic-ref --short HEAD)
59-
git push origin $BRANCH_NAME
60-
fi
61-
id: update
31+
- name: Test
32+
run: forge test -vvv

foundry.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ src = "src"
33
out = "out"
44
libs = ["lib"]
55
remappings = [
6-
'forge-std/=lib/forge-std/src',
7-
'solady/=lib/solady/',
8-
'openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/',
96
'seaport-types/=lib/seaport-types/',
10-
'solarray/=lib/solarray/src/',
11-
'openzeppelin-contracts/contracts/=lib/openzeppelin-contracts/contracts/',
127
]
138
# bytecode_hash = 'none'
149
ignored_error_codes = ['license', 'code-size', 'init-code-size', 2519]

lib/openzeppelin-contracts

src/dynamic-traits/ERC721DynamicTraits.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: CC0-1.0
22
pragma solidity ^0.8.19;
33

4-
import {ERC721} from "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
5-
import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
4+
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
66
import {DynamicTraits} from "src/dynamic-traits/DynamicTraits.sol";
77

88
contract ERC721DynamicTraits is DynamicTraits, Ownable, ERC721 {

src/dynamic-traits/ERC721OnchainTraits.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.19;
33

4-
import {ERC721} from "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
4+
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
55
import {OnchainTraits} from "./OnchainTraits.sol";
66
import {DynamicTraits} from "./DynamicTraits.sol";
77

src/dynamic-traits/OnchainTraits.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {DynamicTraits} from "./DynamicTraits.sol";
55
import {Metadata} from "../onchain/Metadata.sol";
66
import {Ownable} from "solady/src/auth/Ownable.sol";
77
import {SSTORE2} from "solady/src/utils/SSTORE2.sol";
8-
import {EnumerableSet} from "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol";
8+
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
99
import {
1010
TraitLabelStorage,
1111
TraitLabelStorageLib,

src/dynamic-traits/lib/TraitLabelLib.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ library TraitLabelStorageLib {
105105
}
106106
// render the attribute as JSON
107107
return Metadata.attribute({
108-
traitType: traitLabel.traitLabel,
109-
value: actualTraitValue,
110-
displayType: traitLabel.displayType
108+
traitType: traitLabel.traitLabel, value: actualTraitValue, displayType: traitLabel.displayType
111109
});
112110
}
113111

src/reference/ExampleNFT.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ contract ExampleNFT is AbstractNFT {
4444
return Solarray.strings(
4545
Metadata.attribute({traitType: "Example Attribute", value: "Example Value"}),
4646
Metadata.attribute({
47-
traitType: "Number",
48-
value: LibString.toString(tokenId),
49-
displayType: DisplayType.Number
47+
traitType: "Number", value: LibString.toString(tokenId), displayType: DisplayType.Number
5048
}),
5149
Metadata.attribute({traitType: "Parity", value: tokenId % 2 == 0 ? "Even" : "Odd"})
5250
);
@@ -61,7 +59,9 @@ contract ExampleNFT is AbstractNFT {
6159
props: string.concat(svg.prop("width", "500"), svg.prop("height", "500")),
6260
children: string.concat(
6361
svg.rect({
64-
props: string.concat(svg.prop("width", "500"), svg.prop("height", "500"), svg.prop("fill", "lightgray"))
62+
props: string.concat(
63+
svg.prop("width", "500"), svg.prop("height", "500"), svg.prop("fill", "lightgray")
64+
)
6565
}),
6666
svg.text({
6767
props: string.concat(

src/sips/lib/BaseSIPDecoder.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,7 @@ library BaseSIPDecoder {
9696
return decodePackedBytes(extraData, 1);
9797
}
9898

99-
function decodeUintAndBytes(bytes calldata extraData)
100-
internal
101-
pure
102-
returns (uint256 tokenId, bytes calldata data)
103-
{
99+
function decodeUintAndBytes(bytes calldata extraData) internal pure returns (uint256 tokenId, bytes calldata data) {
104100
return decodeUintAndBytes(extraData, 1);
105101
}
106102

0 commit comments

Comments
 (0)