Skip to content

Commit 9bb6b92

Browse files
committed
install openzeppelin-contracts a submodule instead of npm package
1 parent 33aac3e commit 9bb6b92

File tree

16 files changed

+15
-60
lines changed

16 files changed

+15
-60
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "lib/forge-std"]
22
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4-
[submodule "packages/ethereum-contracts/lib/openzeppelin-contracts"]
5-
path = packages/ethereum-contracts/lib/openzeppelin-contracts
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
66
url = https://github.com/OpenZeppelin/openzeppelin-contracts.git
77
branch = release-v5.4

packages/ethereum-contracts/lib/openzeppelin-contracts renamed to lib/openzeppelin-contracts

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
},
5353
"scripts": {
5454
"prepare": "husky && npm run git-submodule:init",
55+
"postinstall": "ln -s ../../lib/openzeppelin-contracts/contracts node_modules/@openzeppelin/contracts",
5556
"lint": "run-s -l lint:*",
5657
"lint:syncpack": "syncpack lint",
5758
"lint:shellcheck": "tasks/shellcheck-all-tasks.sh",

packages/automation-contracts/autowrap/foundry.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ root = '../../../'
33
libs = ['lib']
44
src = 'packages/automation-contracts/autowrap'
55
solc_version = "0.8.30"
6-
evm_version = 'shanghai'
6+
evm_version = 'cancun'
77
optimizer = true
88
optimizer_runs = 200
99
remappings = [
1010
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
1111
'@superfluid-finance/ethereum-contracts/=packages/ethereum-contracts/',
12-
'@openzeppelin/=node_modules/@openzeppelin/',
12+
'@openzeppelin/=lib/openzeppelin-contracts/',
1313
'ds-test/=lib/forge-std/lib/ds-test/src/',
1414
'forge-std/=lib/forge-std/src/']
1515
out = 'packages/automation-contracts/autowrap/out/default'

packages/automation-contracts/autowrap/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"description": "Open contracts that allow upgrading underlying token to supertokens based on running stream",
44
"version": "0.3.0",
55
"devDependencies": {
6-
"@openzeppelin/contracts": "^5.4.0",
76
"@superfluid-finance/ethereum-contracts": "^1.13.0",
87
"@superfluid-finance/metadata": "^1.6.0"
98
},

packages/automation-contracts/scheduler/foundry.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ root = '../../../'
33
libs = ['lib']
44
src = 'packages/automation-contracts/scheduler'
55
solc_version = "0.8.30"
6-
evm_version = 'shanghai'
6+
evm_version = 'cancun'
77
optimizer = true
88
optimizer_runs = 200
99
remappings = [
1010
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
1111
'@superfluid-finance/ethereum-contracts/=packages/ethereum-contracts/',
12-
'@openzeppelin/=node_modules/@openzeppelin/',
12+
'@openzeppelin/=lib/openzeppelin-contracts/',
1313
'ds-test/=lib/forge-std/lib/ds-test/src/',
1414
'forge-std/=lib/forge-std/src/']
1515
out = 'packages/automation-contracts/scheduler/out/default'

packages/automation-contracts/scheduler/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"description": "Open contracts that allow scheduling streams and vestings onchain",
44
"version": "1.3.0",
55
"devDependencies": {
6-
"@openzeppelin/contracts": "^5.4.0",
76
"@superfluid-finance/ethereum-contracts": "^1.13.0",
87
"@superfluid-finance/metadata": "^1.6.0"
98
},

packages/ethereum-contracts/foundry.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ ignored_error_codes = [
88
1699 # assembly { selfdestruct } in contracts/mocks/SuperfluidDestructorMock.sol
99
]
1010
# keep in sync with truffle-config.js
11-
evm_version = 'shanghai'
11+
evm_version = 'cancun'
1212
optimizer = true
1313
optimizer_runs = 200
1414
remappings = [
1515
'@superfluid-finance/ethereum-contracts/contracts/=packages/ethereum-contracts/contracts/',
1616
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
17-
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/',
17+
'@openzeppelin/=lib/openzeppelin-contracts/',
1818
'ds-test/=lib/forge-std/lib/ds-test/src/',
1919
'forge-std/=lib/forge-std/src/']
2020
out = 'packages/ethereum-contracts/build/foundry/default'

packages/ethereum-contracts/hardhat.config.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import "solidity-coverage";
1313
import {config as dotenvConfig} from "dotenv";
1414
import {NetworkUserConfig} from "hardhat/types";
1515
import "solidity-docgen";
16-
import {relative, resolve} from "path";
16+
import {relative} from "path";
1717

1818
try {
1919
dotenvConfig();
@@ -54,33 +54,6 @@ subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(
5454
}
5555
);
5656

57-
// New subtask to define remappings
58-
subtask(TASK_COMPILE_GET_REMAPPINGS).setAction(
59-
async (_, { config }, runSuper) => {
60-
console.log("=== TASK_COMPILE_GET_REMAPPINGS START ===");
61-
62-
// Get default remappings (if any)
63-
const remappings = await runSuper();
64-
65-
console.log("Type of remappings:", typeof remappings);
66-
console.log("Remappings object:", remappings);
67-
68-
// Add hardcoded remapping for OpenZeppelin
69-
const openzeppelinPath = "../../../lib/openzeppelin-contracts/contracts";
70-
console.log("Adding OpenZeppelin remapping:", `@openzeppelin/contracts -> ${openzeppelinPath}`);
71-
72-
// Return the remappings object with our custom mapping
73-
const newRemappings = {
74-
...remappings,
75-
"@openzeppelin/contracts/": "lib/openzeppelin-contracts/contracts/",
76-
};
77-
78-
console.log("New remappings object:", newRemappings);
79-
80-
return newRemappings;
81-
}
82-
);
83-
8457
const chainIds = {
8558
"eth-mainnet": 1,
8659
"eth-sepolia": 11155111,
@@ -131,11 +104,7 @@ const config: HardhatUserConfig = {
131104
},
132105
},
133106
paths: {
134-
root: "../../",
135-
sources: "packages/ethereum-contracts/contracts",
136-
artifacts: "packages/ethereum-contracts/build/hardhat",
137-
tests: "packages/ethereum-contracts/test",
138-
cache: "packages/ethereum-contracts/cache",
107+
artifacts: "build/hardhat",
139108
},
140109
networks: {
141110
"bsc-mainnet": {
@@ -206,7 +175,6 @@ const config: HardhatUserConfig = {
206175
: undefined,
207176
},
208177
typechain: {
209-
outDir: "packages/ethereum-contracts/typechain-types",
210178
target: "ethers-v5"
211179
},
212180
};

packages/ethereum-contracts/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"dependencies": {
66
"@decentral.ee/web3-helpers": "0.5.3",
77
"@nomiclabs/hardhat-ethers": "2.2.3",
8-
"@openzeppelin/contracts": "5.4.0",
98
"@truffle/contract": "4.6.31",
109
"ethereumjs-tx": "2.1.2",
1110
"ethereumjs-util": "7.1.5",

0 commit comments

Comments
 (0)