From d6567402435f21fc181543939ff25aba8c23832a Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 11 Mar 2025 16:43:01 +0100 Subject: [PATCH 1/9] OZ v4 is now explicitly mapped as such in import paths --- .../contracts/agreements/AgreementLibrary.sol | 2 +- .../agreements/ConstantFlowAgreementV1.sol | 2 +- .../agreements/InstantDistributionAgreementV1.sol | 2 +- .../gdav1/GeneralDistributionAgreementV1.sol | 2 +- .../contracts/agreements/gdav1/PoolAdminNFT.sol | 2 +- .../contracts/agreements/gdav1/PoolMemberNFT.sol | 2 +- .../contracts/agreements/gdav1/PoolNFTBase.sol | 5 ++++- .../contracts/agreements/gdav1/SuperfluidPool.sol | 4 ++-- .../gdav1/SuperfluidPoolDeployerLibrary.sol | 2 +- .../contracts/gov/SuperfluidGovernanceII.sol | 2 +- .../interfaces/agreements/gdav1/IPoolNFTBase.sol | 2 +- .../agreements/gdav1/ISuperfluidPool.sol | 2 +- .../interfaces/superfluid/ISuperToken.sol | 4 ++-- .../interfaces/superfluid/ISuperTokenFactory.sol | 2 +- .../interfaces/superfluid/ISuperfluid.sol | 4 ++-- .../contracts/libs/ERC777Helper.sol | 2 +- .../contracts/mocks/AgreementMock.t.sol | 2 +- .../mocks/ERC777SenderRecipientMock.t.sol | 14 +++++++------- .../contracts/mocks/SuperTokenMock.t.sol | 2 +- .../superfluid/FullUpgradableSuperTokenProxy.sol | 2 +- .../contracts/superfluid/SuperToken.sol | 12 ++++++------ .../contracts/superfluid/SuperTokenFactory.sol | 4 ++-- .../contracts/superfluid/Superfluid.sol | 2 +- .../contracts/superfluid/SuperfluidToken.sol | 4 ++-- .../contracts/tokens/PureSuperToken.sol | 2 +- .../contracts/upgradability/BeaconProxiable.sol | 2 +- .../upgradability/SuperfluidUpgradeableBeacon.sol | 2 +- .../contracts/upgradability/UUPSProxiable.sol | 2 +- .../contracts/upgradability/UUPSProxy.sol | 2 +- .../contracts/utils/BatchLiquidator.sol | 2 +- .../contracts/utils/ERC2771Forwarder.sol | 2 +- .../contracts/utils/Resolver.sol | 2 +- .../contracts/utils/SimpleForwarder.sol | 2 +- .../contracts/utils/SuperUpgrader.sol | 4 ++-- .../utils/SuperfluidFrameworkDeployer.t.sol | 4 ++-- .../ethereum-contracts/contracts/utils/TOGA.sol | 6 +++--- .../contracts/utils/TestGovernance.sol | 2 +- .../contracts/utils/TestToken.sol | 2 +- packages/ethereum-contracts/package.json | 2 +- .../test/foundry/FoundrySuperfluidTester.t.sol | 4 ++-- .../gdav1/GeneralDistributionAgreement.t.sol | 4 ++-- .../GeneralDistributionAgreementV1.prop.t.sol | 2 +- .../test/foundry/superfluid/ERC721.t.sol | 2 +- .../test/foundry/superfluid/PoolAdminNFT.t.sol | 4 ++-- .../test/foundry/superfluid/PoolMemberNFT.t.sol | 4 ++-- .../test/foundry/superfluid/PoolNFTBase.t.sol | 4 ++-- .../test/foundry/superfluid/PoolNFTMock.t.sol | 2 +- .../foundry/superfluid/Superfluid.BatchCall.t.sol | 2 +- .../test/foundry/utils/TOGA.t.sol | 4 ++-- yarn.lock | 5 +++++ 50 files changed, 83 insertions(+), 75 deletions(-) diff --git a/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol b/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol index 6d7324c214..7abe972203 100644 --- a/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol +++ b/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol @@ -9,7 +9,7 @@ import { } from "../interfaces/superfluid/ISuperfluid.sol"; import { ISuperfluidToken } from "../interfaces/superfluid/ISuperfluidToken.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; /** diff --git a/packages/ethereum-contracts/contracts/agreements/ConstantFlowAgreementV1.sol b/packages/ethereum-contracts/contracts/agreements/ConstantFlowAgreementV1.sol index bf225b729b..8536a32363 100644 --- a/packages/ethereum-contracts/contracts/agreements/ConstantFlowAgreementV1.sol +++ b/packages/ethereum-contracts/contracts/agreements/ConstantFlowAgreementV1.sol @@ -13,7 +13,7 @@ import { SuperfluidGovernanceConfigs } from "../interfaces/superfluid/ISuperfluid.sol"; import { AgreementBase } from "./AgreementBase.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { AgreementLibrary } from "./AgreementLibrary.sol"; import { SolvencyHelperLibrary } from "../libs/SolvencyHelperLibrary.sol"; diff --git a/packages/ethereum-contracts/contracts/agreements/InstantDistributionAgreementV1.sol b/packages/ethereum-contracts/contracts/agreements/InstantDistributionAgreementV1.sol index 701852a2c4..ae538638cb 100644 --- a/packages/ethereum-contracts/contracts/agreements/InstantDistributionAgreementV1.sol +++ b/packages/ethereum-contracts/contracts/agreements/InstantDistributionAgreementV1.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { IInstantDistributionAgreementV1, ISuperfluidToken diff --git a/packages/ethereum-contracts/contracts/agreements/gdav1/GeneralDistributionAgreementV1.sol b/packages/ethereum-contracts/contracts/agreements/gdav1/GeneralDistributionAgreementV1.sol index c7c02135ff..90cda61b3f 100644 --- a/packages/ethereum-contracts/contracts/agreements/gdav1/GeneralDistributionAgreementV1.sol +++ b/packages/ethereum-contracts/contracts/agreements/gdav1/GeneralDistributionAgreementV1.sol @@ -2,7 +2,7 @@ // solhint-disable not-rely-on-time pragma solidity ^0.8.23; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { ISuperfluid, ISuperfluidGovernance } from "../../interfaces/superfluid/ISuperfluid.sol"; import { diff --git a/packages/ethereum-contracts/contracts/agreements/gdav1/PoolAdminNFT.sol b/packages/ethereum-contracts/contracts/agreements/gdav1/PoolAdminNFT.sol index 4b86cb5b83..66c478bca2 100644 --- a/packages/ethereum-contracts/contracts/agreements/gdav1/PoolAdminNFT.sol +++ b/packages/ethereum-contracts/contracts/agreements/gdav1/PoolAdminNFT.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; +import { IERC721Metadata } from "@openzeppelin/contracts-v4/token/ERC721/extensions/IERC721Metadata.sol"; import { IPoolAdminNFT } from "../../interfaces/agreements/gdav1/IPoolAdminNFT.sol"; import { PoolNFTBase } from "./PoolNFTBase.sol"; import { IGeneralDistributionAgreementV1, ISuperfluid } from "../../interfaces/superfluid/ISuperfluid.sol"; diff --git a/packages/ethereum-contracts/contracts/agreements/gdav1/PoolMemberNFT.sol b/packages/ethereum-contracts/contracts/agreements/gdav1/PoolMemberNFT.sol index 2387806555..916ecc00b6 100644 --- a/packages/ethereum-contracts/contracts/agreements/gdav1/PoolMemberNFT.sol +++ b/packages/ethereum-contracts/contracts/agreements/gdav1/PoolMemberNFT.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; +import { IERC721Metadata } from "@openzeppelin/contracts-v4/token/ERC721/extensions/IERC721Metadata.sol"; import { IPoolMemberNFT } from "../../interfaces/agreements/gdav1/IPoolMemberNFT.sol"; import { PoolNFTBase } from "./PoolNFTBase.sol"; import { IGeneralDistributionAgreementV1, ISuperfluid } from "../../interfaces/superfluid/ISuperfluid.sol"; diff --git a/packages/ethereum-contracts/contracts/agreements/gdav1/PoolNFTBase.sol b/packages/ethereum-contracts/contracts/agreements/gdav1/PoolNFTBase.sol index c0a061103c..59ee817335 100644 --- a/packages/ethereum-contracts/contracts/agreements/gdav1/PoolNFTBase.sol +++ b/packages/ethereum-contracts/contracts/agreements/gdav1/PoolNFTBase.sol @@ -6,7 +6,10 @@ pragma solidity ^0.8.23; // Notes: We use these interfaces in natspec documentation below, grep @inheritdoc // solhint-disable-next-line no-unused-import -import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; +import { + IERC165, + IERC721 +} from "@openzeppelin/contracts-v4/token/ERC721/extensions/IERC721Metadata.sol"; import { UUPSProxiable } from "../../upgradability/UUPSProxiable.sol"; import { IGeneralDistributionAgreementV1, ISuperfluid } from "../../interfaces/superfluid/ISuperfluid.sol"; import { ISuperTokenFactory } from "../../interfaces/superfluid/ISuperTokenFactory.sol"; diff --git a/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPool.sol b/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPool.sol index 60d586a76c..2eddce7564 100644 --- a/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPool.sol +++ b/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPool.sol @@ -4,8 +4,8 @@ pragma solidity ^0.8.23; // Notes: We use these interfaces in natspec documentation below, grep @inheritdoc // solhint-disable-next-line no-unused-import -import { IERC20, IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { IERC20, IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { BasicParticle, SemanticMoney, diff --git a/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPoolDeployerLibrary.sol b/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPoolDeployerLibrary.sol index 5b7682cbba..91100b4560 100644 --- a/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPoolDeployerLibrary.sol +++ b/packages/ethereum-contracts/contracts/agreements/gdav1/SuperfluidPoolDeployerLibrary.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { BeaconProxy } from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; +import { BeaconProxy } from "@openzeppelin/contracts-v4/proxy/beacon/BeaconProxy.sol"; import { ISuperfluidToken } from "../../interfaces/superfluid/ISuperfluidToken.sol"; import { SuperfluidPool } from "./SuperfluidPool.sol"; import { PoolConfig, PoolERC20Metadata } from "../../interfaces/agreements/gdav1/IGeneralDistributionAgreementV1.sol"; diff --git a/packages/ethereum-contracts/contracts/gov/SuperfluidGovernanceII.sol b/packages/ethereum-contracts/contracts/gov/SuperfluidGovernanceII.sol index 541c24254d..9bc671a33c 100644 --- a/packages/ethereum-contracts/contracts/gov/SuperfluidGovernanceII.sol +++ b/packages/ethereum-contracts/contracts/gov/SuperfluidGovernanceII.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.23; import { UUPSProxy } from "../upgradability/UUPSProxy.sol"; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; import { UUPSProxiable } from "../upgradability/UUPSProxiable.sol"; import { SuperfluidGovernanceBase } from "./SuperfluidGovernanceBase.sol"; import { ISuperfluid } from "../interfaces/superfluid/ISuperfluid.sol"; diff --git a/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/IPoolNFTBase.sol b/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/IPoolNFTBase.sol index 587c7c97d5..67a6b01e17 100644 --- a/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/IPoolNFTBase.sol +++ b/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/IPoolNFTBase.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity >=0.8.4; -import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; +import { IERC721Metadata } from "@openzeppelin/contracts-v4/token/ERC721/extensions/IERC721Metadata.sol"; interface IPoolNFTBase is IERC721Metadata { error POOL_NFT_APPROVE_TO_CALLER(); // 0x9212b333 diff --git a/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/ISuperfluidPool.sol b/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/ISuperfluidPool.sol index 5524318c49..db6741cdfe 100644 --- a/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/ISuperfluidPool.sol +++ b/packages/ethereum-contracts/contracts/interfaces/agreements/gdav1/ISuperfluidPool.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity >=0.8.4; -import { IERC20, IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import { IERC20, IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; import { ISuperfluidToken } from "../../superfluid/ISuperfluidToken.sol"; /** diff --git a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol index c1a468f631..af42b56f0a 100644 --- a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol +++ b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol @@ -2,8 +2,8 @@ pragma solidity >= 0.8.11; import { ISuperfluidToken } from "./ISuperfluidToken.sol"; -import { IERC20, IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol"; +import { IERC20, IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; +import { IERC777 } from "@openzeppelin/contracts-v4/token/ERC777/IERC777.sol"; import { IPoolAdminNFT } from "../agreements/gdav1/IPoolAdminNFT.sol"; import { IPoolMemberNFT } from "../agreements/gdav1/IPoolMemberNFT.sol"; diff --git a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol index 9796eb6240..cfbe31a7fa 100644 --- a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol +++ b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >= 0.8.11; -import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import { IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; import { ISuperToken } from "./ISuperToken.sol"; /** * @title Super token factory interface diff --git a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol index 97d60cc6e3..e02947892f 100644 --- a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol +++ b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol @@ -16,8 +16,8 @@ import { } from "./Definitions.sol"; /// Super token related interfaces: /// Note: CustomSuperTokenBase is not included for people building CustomSuperToken. -import { IERC20, IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol"; +import { IERC20, IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; +import { IERC777 } from "@openzeppelin/contracts-v4/token/ERC777/IERC777.sol"; import { ISuperfluidToken } from "./ISuperfluidToken.sol"; import { ISuperToken } from "./ISuperToken.sol"; import { ISuperTokenFactory } from "./ISuperTokenFactory.sol"; diff --git a/packages/ethereum-contracts/contracts/libs/ERC777Helper.sol b/packages/ethereum-contracts/contracts/libs/ERC777Helper.sol index 1842629981..10f50a041b 100644 --- a/packages/ethereum-contracts/contracts/libs/ERC777Helper.sol +++ b/packages/ethereum-contracts/contracts/libs/ERC777Helper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC1820Registry } from "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol"; +import { IERC1820Registry } from "@openzeppelin/contracts-v4/utils/introspection/IERC1820Registry.sol"; /** * @title ERC777 helper library diff --git a/packages/ethereum-contracts/contracts/mocks/AgreementMock.t.sol b/packages/ethereum-contracts/contracts/mocks/AgreementMock.t.sol index bcfac48017..479b276db6 100644 --- a/packages/ethereum-contracts/contracts/mocks/AgreementMock.t.sol +++ b/packages/ethereum-contracts/contracts/mocks/AgreementMock.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { ISuperfluid, diff --git a/packages/ethereum-contracts/contracts/mocks/ERC777SenderRecipientMock.t.sol b/packages/ethereum-contracts/contracts/mocks/ERC777SenderRecipientMock.t.sol index f6ca024fce..0aa9208e87 100644 --- a/packages/ethereum-contracts/contracts/mocks/ERC777SenderRecipientMock.t.sol +++ b/packages/ethereum-contracts/contracts/mocks/ERC777SenderRecipientMock.t.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { Context } from "@openzeppelin/contracts/utils/Context.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol"; -import { IERC777Sender } from "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol"; -import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; -import { IERC1820Registry } from "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol"; +import { Context } from "@openzeppelin/contracts-v4/utils/Context.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; +import { IERC777 } from "@openzeppelin/contracts-v4/token/ERC777/IERC777.sol"; +import { IERC777Sender } from "@openzeppelin/contracts-v4/token/ERC777/IERC777Sender.sol"; +import { IERC777Recipient } from "@openzeppelin/contracts-v4/token/ERC777/IERC777Recipient.sol"; +import { IERC1820Registry } from "@openzeppelin/contracts-v4/utils/introspection/IERC1820Registry.sol"; import { ERC1820Implementer, IERC1820Implementer -} from "@openzeppelin/contracts/utils/introspection/ERC1820Implementer.sol"; +} from "@openzeppelin/contracts-v4/utils/introspection/ERC1820Implementer.sol"; import { ISuperToken } from "../superfluid/SuperToken.sol"; diff --git a/packages/ethereum-contracts/contracts/mocks/SuperTokenMock.t.sol b/packages/ethereum-contracts/contracts/mocks/SuperTokenMock.t.sol index 402c753631..51ef4a83de 100644 --- a/packages/ethereum-contracts/contracts/mocks/SuperTokenMock.t.sol +++ b/packages/ethereum-contracts/contracts/mocks/SuperTokenMock.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import { ISuperfluid, IERC20, IPoolAdminNFT, IPoolMemberNFT diff --git a/packages/ethereum-contracts/contracts/superfluid/FullUpgradableSuperTokenProxy.sol b/packages/ethereum-contracts/contracts/superfluid/FullUpgradableSuperTokenProxy.sol index 5870bd8174..24029c06da 100644 --- a/packages/ethereum-contracts/contracts/superfluid/FullUpgradableSuperTokenProxy.sol +++ b/packages/ethereum-contracts/contracts/superfluid/FullUpgradableSuperTokenProxy.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.23; import { ISuperTokenFactory } from "../interfaces/superfluid/ISuperTokenFactory.sol"; -import { Proxy } from "@openzeppelin/contracts/proxy/Proxy.sol"; +import { Proxy } from "@openzeppelin/contracts-v4/proxy/Proxy.sol"; /** diff --git a/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol b/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol index dbb0db043f..561f813472 100644 --- a/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol +++ b/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol @@ -14,12 +14,12 @@ import { } from "../interfaces/superfluid/ISuperfluid.sol"; import { SuperfluidToken } from "./SuperfluidToken.sol"; import { ERC777Helper } from "../libs/ERC777Helper.sol"; -import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; -import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; -import { IERC777Sender } from "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol"; -import { Address } from "@openzeppelin/contracts/utils/Address.sol"; +import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; +import { SafeMath } from "@openzeppelin/contracts-v4/utils/math/SafeMath.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; +import { IERC777Recipient } from "@openzeppelin/contracts-v4/token/ERC777/IERC777Recipient.sol"; +import { IERC777Sender } from "@openzeppelin/contracts-v4/token/ERC777/IERC777Sender.sol"; +import { Address } from "@openzeppelin/contracts-v4/utils/Address.sol"; // placeholder types needed as an intermediate step before complete removal of FlowNFTs // solhint-disable-next-line no-empty-blocks diff --git a/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol b/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol index 55823bf0e4..92e9df7677 100644 --- a/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol +++ b/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; import { ISuperTokenFactory, ISuperToken diff --git a/packages/ethereum-contracts/contracts/superfluid/Superfluid.sol b/packages/ethereum-contracts/contracts/superfluid/Superfluid.sol index 258a1f4856..9c84ef7d45 100644 --- a/packages/ethereum-contracts/contracts/superfluid/Superfluid.sol +++ b/packages/ethereum-contracts/contracts/superfluid/Superfluid.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { UUPSProxiable } from "../upgradability/UUPSProxiable.sol"; import { UUPSProxy } from "../upgradability/UUPSProxy.sol"; diff --git a/packages/ethereum-contracts/contracts/superfluid/SuperfluidToken.sol b/packages/ethereum-contracts/contracts/superfluid/SuperfluidToken.sol index cb5218676e..cf59d08265 100644 --- a/packages/ethereum-contracts/contracts/superfluid/SuperfluidToken.sol +++ b/packages/ethereum-contracts/contracts/superfluid/SuperfluidToken.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { ISuperfluid, ISuperAgreement, diff --git a/packages/ethereum-contracts/contracts/tokens/PureSuperToken.sol b/packages/ethereum-contracts/contracts/tokens/PureSuperToken.sol index 0deeb3dcff..4cb0cc56f6 100644 --- a/packages/ethereum-contracts/contracts/tokens/PureSuperToken.sol +++ b/packages/ethereum-contracts/contracts/tokens/PureSuperToken.sol @@ -8,7 +8,7 @@ import { from "../interfaces/superfluid/CustomSuperTokenBase.sol"; import { IPureSuperTokenCustom } from "../interfaces/tokens/IPureSuperToken.sol"; import { UUPSProxy } from "../upgradability/UUPSProxy.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; /** diff --git a/packages/ethereum-contracts/contracts/upgradability/BeaconProxiable.sol b/packages/ethereum-contracts/contracts/upgradability/BeaconProxiable.sol index 43db85e730..2afd307934 100644 --- a/packages/ethereum-contracts/contracts/upgradability/BeaconProxiable.sol +++ b/packages/ethereum-contracts/contracts/upgradability/BeaconProxiable.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import { Initializable } from "@openzeppelin/contracts-v4/proxy/utils/Initializable.sol"; abstract contract BeaconProxiable is Initializable { diff --git a/packages/ethereum-contracts/contracts/upgradability/SuperfluidUpgradeableBeacon.sol b/packages/ethereum-contracts/contracts/upgradability/SuperfluidUpgradeableBeacon.sol index 3dc1bbc9f6..dc41afde80 100644 --- a/packages/ethereum-contracts/contracts/upgradability/SuperfluidUpgradeableBeacon.sol +++ b/packages/ethereum-contracts/contracts/upgradability/SuperfluidUpgradeableBeacon.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.23; import { UpgradeableBeacon -} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; +} from "@openzeppelin/contracts-v4/proxy/beacon/UpgradeableBeacon.sol"; import { BeaconProxiable } from "./BeaconProxiable.sol"; contract SuperfluidUpgradeableBeacon is UpgradeableBeacon { diff --git a/packages/ethereum-contracts/contracts/upgradability/UUPSProxiable.sol b/packages/ethereum-contracts/contracts/upgradability/UUPSProxiable.sol index 13f5fc9036..2bf71f88aa 100644 --- a/packages/ethereum-contracts/contracts/upgradability/UUPSProxiable.sol +++ b/packages/ethereum-contracts/contracts/upgradability/UUPSProxiable.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.23; import { UUPSUtils } from "./UUPSUtils.sol"; -import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import { Initializable } from "@openzeppelin/contracts-v4/proxy/utils/Initializable.sol"; /** * @title UUPS (Universal Upgradeable Proxy Standard) Proxiable contract. diff --git a/packages/ethereum-contracts/contracts/upgradability/UUPSProxy.sol b/packages/ethereum-contracts/contracts/upgradability/UUPSProxy.sol index c871838a61..36a2a63502 100644 --- a/packages/ethereum-contracts/contracts/upgradability/UUPSProxy.sol +++ b/packages/ethereum-contracts/contracts/upgradability/UUPSProxy.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.23; import { UUPSUtils } from "./UUPSUtils.sol"; -import { Proxy } from "@openzeppelin/contracts/proxy/Proxy.sol"; +import { Proxy } from "@openzeppelin/contracts-v4/proxy/Proxy.sol"; /** diff --git a/packages/ethereum-contracts/contracts/utils/BatchLiquidator.sol b/packages/ethereum-contracts/contracts/utils/BatchLiquidator.sol index d8d2ccd01e..6089ddd80a 100644 --- a/packages/ethereum-contracts/contracts/utils/BatchLiquidator.sol +++ b/packages/ethereum-contracts/contracts/utils/BatchLiquidator.sol @@ -5,7 +5,7 @@ import { ISuperfluid, ISuperAgreement, ISuperToken, ISuperfluidPool, IConstantFlowAgreementV1, IGeneralDistributionAgreementV1 } from "../interfaces/superfluid/ISuperfluid.sol"; -import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import { ERC20 } from "@openzeppelin/contracts-v4/token/ERC20/ERC20.sol"; /** * @title Batch liquidator contract diff --git a/packages/ethereum-contracts/contracts/utils/ERC2771Forwarder.sol b/packages/ethereum-contracts/contracts/utils/ERC2771Forwarder.sol index cc2da07420..38af8a8b9b 100644 --- a/packages/ethereum-contracts/contracts/utils/ERC2771Forwarder.sol +++ b/packages/ethereum-contracts/contracts/utils/ERC2771Forwarder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; /** * @title Forwards calls preserving the original msg.sender according to ERC-2771 diff --git a/packages/ethereum-contracts/contracts/utils/Resolver.sol b/packages/ethereum-contracts/contracts/utils/Resolver.sol index 36ee7aa156..56eb9c7fe4 100644 --- a/packages/ethereum-contracts/contracts/utils/Resolver.sol +++ b/packages/ethereum-contracts/contracts/utils/Resolver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.11; -import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; +import { AccessControlEnumerable } from "@openzeppelin/contracts-v4/access/AccessControlEnumerable.sol"; import { IResolver } from "../interfaces/utils/IResolver.sol"; diff --git a/packages/ethereum-contracts/contracts/utils/SimpleForwarder.sol b/packages/ethereum-contracts/contracts/utils/SimpleForwarder.sol index 612c9734cd..5ea1f37f2b 100644 --- a/packages/ethereum-contracts/contracts/utils/SimpleForwarder.sol +++ b/packages/ethereum-contracts/contracts/utils/SimpleForwarder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.23; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; /** * @title Forwards arbitrary calls diff --git a/packages/ethereum-contracts/contracts/utils/SuperUpgrader.sol b/packages/ethereum-contracts/contracts/utils/SuperUpgrader.sol index ba410beb21..460753ad2f 100644 --- a/packages/ethereum-contracts/contracts/utils/SuperUpgrader.sol +++ b/packages/ethereum-contracts/contracts/utils/SuperUpgrader.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; -import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import { AccessControlEnumerable } from "@openzeppelin/contracts-v4/access/AccessControlEnumerable.sol"; +import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import { ISuperToken, IERC20 diff --git a/packages/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.t.sol b/packages/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.t.sol index ce98d91d71..40b4b94a4b 100644 --- a/packages/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.t.sol +++ b/packages/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.11; -import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { IERC20Metadata } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; import { SuperfluidFrameworkDeploymentSteps, TokenDeployerLibrary } from "./SuperfluidFrameworkDeploymentSteps.t.sol"; import { ISuperTokenFactory } from "../superfluid/SuperTokenFactory.sol"; import { SuperToken } from "../superfluid/SuperToken.sol"; diff --git a/packages/ethereum-contracts/contracts/utils/TOGA.sol b/packages/ethereum-contracts/contracts/utils/TOGA.sol index 30dcf941c5..c56f4faf7c 100644 --- a/packages/ethereum-contracts/contracts/utils/TOGA.sol +++ b/packages/ethereum-contracts/contracts/utils/TOGA.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { ISuperfluid, ISuperToken, IConstantFlowAgreementV1 } from "../interfaces/superfluid/ISuperfluid.sol"; -import { IERC1820Registry } from "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol"; -import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; +import { IERC1820Registry } from "@openzeppelin/contracts-v4/utils/introspection/IERC1820Registry.sol"; +import { IERC777Recipient } from "@openzeppelin/contracts-v4/token/ERC777/IERC777Recipient.sol"; /** * @title TOGA: Transparent Ongoing Auction diff --git a/packages/ethereum-contracts/contracts/utils/TestGovernance.sol b/packages/ethereum-contracts/contracts/utils/TestGovernance.sol index 33ee9c7182..a3dd0aba43 100644 --- a/packages/ethereum-contracts/contracts/utils/TestGovernance.sol +++ b/packages/ethereum-contracts/contracts/utils/TestGovernance.sol @@ -7,7 +7,7 @@ import { } from "../interfaces/superfluid/ISuperfluid.sol"; import { SuperfluidGovernanceBase } from "../gov/SuperfluidGovernanceBase.sol"; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; /** diff --git a/packages/ethereum-contracts/contracts/utils/TestToken.sol b/packages/ethereum-contracts/contracts/utils/TestToken.sol index cea59f442f..f705dc4cff 100644 --- a/packages/ethereum-contracts/contracts/utils/TestToken.sol +++ b/packages/ethereum-contracts/contracts/utils/TestToken.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.11; -import { ERC20, ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; +import { ERC20, ERC20Permit } from "@openzeppelin/contracts-v4/token/ERC20/extensions/ERC20Permit.sol"; /** * @title Test token contract diff --git a/packages/ethereum-contracts/package.json b/packages/ethereum-contracts/package.json index eff4ccd362..3d28a23f98 100644 --- a/packages/ethereum-contracts/package.json +++ b/packages/ethereum-contracts/package.json @@ -5,7 +5,7 @@ "dependencies": { "@decentral.ee/web3-helpers": "0.5.3", "@nomiclabs/hardhat-ethers": "2.2.3", - "@openzeppelin/contracts": "4.9.6", + "@openzeppelin/contracts-v4": "npm:@openzeppelin/contracts@4.9.6", "@truffle/contract": "4.6.31", "ethereumjs-tx": "2.1.2", "ethereumjs-util": "7.1.5", diff --git a/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.t.sol b/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.t.sol index b289cace21..41b560973f 100644 --- a/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.t.sol +++ b/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.t.sol @@ -3,8 +3,8 @@ pragma solidity >=0.8.11; import "forge-std/Test.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; -import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; +import { EnumerableSet } from "@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol"; import { ERC1820RegistryCompiled } from "../../contracts/libs/ERC1820RegistryCompiled.sol"; import { SuperfluidFrameworkDeployer } from "../../contracts/utils/SuperfluidFrameworkDeployer.t.sol"; import { Superfluid } from "../../contracts/superfluid/Superfluid.sol"; diff --git a/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreement.t.sol b/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreement.t.sol index 59be7a3a39..f1e1db3db8 100644 --- a/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreement.t.sol +++ b/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreement.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { EnumerableSet } from "@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import "@superfluid-finance/solidity-semantic-money/src/SemanticMoney.sol"; import "../../FoundrySuperfluidTester.t.sol"; import { diff --git a/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreementV1.prop.t.sol b/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreementV1.prop.t.sol index 323d265830..5926ef242d 100644 --- a/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreementV1.prop.t.sol +++ b/packages/ethereum-contracts/test/foundry/agreements/gdav1/GeneralDistributionAgreementV1.prop.t.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.23; import "forge-std/Test.sol"; -import { IBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; +import { IBeacon } from "@openzeppelin/contracts-v4/proxy/beacon/UpgradeableBeacon.sol"; import "@superfluid-finance/solidity-semantic-money/src/SemanticMoney.sol"; import { ERC1820RegistryCompiled } from "../../../../contracts/libs/ERC1820RegistryCompiled.sol"; diff --git a/packages/ethereum-contracts/test/foundry/superfluid/ERC721.t.sol b/packages/ethereum-contracts/test/foundry/superfluid/ERC721.t.sol index 090e46de20..7b79751b20 100644 --- a/packages/ethereum-contracts/test/foundry/superfluid/ERC721.t.sol +++ b/packages/ethereum-contracts/test/foundry/superfluid/ERC721.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC721Metadata } from "@openzeppelin/contracts/interfaces/IERC721Metadata.sol"; +import { IERC721Metadata } from "@openzeppelin/contracts-v4/interfaces/IERC721Metadata.sol"; import { FoundrySuperfluidTester } from "../FoundrySuperfluidTester.t.sol"; import { PoolAdminNFTMock, PoolMemberNFTMock } from "./PoolNFTMock.t.sol"; import { TestToken } from "../../../contracts/utils/TestToken.sol"; diff --git a/packages/ethereum-contracts/test/foundry/superfluid/PoolAdminNFT.t.sol b/packages/ethereum-contracts/test/foundry/superfluid/PoolAdminNFT.t.sol index 1d33ffbea6..9873398a04 100644 --- a/packages/ethereum-contracts/test/foundry/superfluid/PoolAdminNFT.t.sol +++ b/packages/ethereum-contracts/test/foundry/superfluid/PoolAdminNFT.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; -import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; +import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts-v4/token/ERC721/extensions/IERC721Metadata.sol"; +import { Strings } from "@openzeppelin/contracts-v4/utils/Strings.sol"; import { PoolNFTBaseIntegrationTest, FakePool } from "./PoolNFTBase.t.sol"; import { IPoolNFTBase } from "../../../contracts/interfaces/agreements/gdav1/IPoolNFTBase.sol"; import { IPoolAdminNFT } from "../../../contracts/interfaces/agreements/gdav1/IPoolAdminNFT.sol"; diff --git a/packages/ethereum-contracts/test/foundry/superfluid/PoolMemberNFT.t.sol b/packages/ethereum-contracts/test/foundry/superfluid/PoolMemberNFT.t.sol index dad71ff3c9..4d35f52d34 100644 --- a/packages/ethereum-contracts/test/foundry/superfluid/PoolMemberNFT.t.sol +++ b/packages/ethereum-contracts/test/foundry/superfluid/PoolMemberNFT.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; -import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; +import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts-v4/token/ERC721/extensions/IERC721Metadata.sol"; +import { Strings } from "@openzeppelin/contracts-v4/utils/Strings.sol"; import { PoolNFTBaseIntegrationTest, FakePool } from "./PoolNFTBase.t.sol"; import { IPoolNFTBase } from "../../../contracts/interfaces/agreements/gdav1/IPoolNFTBase.sol"; import { IPoolMemberNFT } from "../../../contracts/interfaces/agreements/gdav1/IPoolMemberNFT.sol"; diff --git a/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTBase.t.sol b/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTBase.t.sol index 03fbf57e29..f48cbff5de 100644 --- a/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTBase.t.sol +++ b/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTBase.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPLv3 pragma solidity ^0.8.23; -import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts/interfaces/IERC721Metadata.sol"; -import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; +import { IERC165, IERC721, IERC721Metadata } from "@openzeppelin/contracts-v4/interfaces/IERC721Metadata.sol"; +import { Strings } from "@openzeppelin/contracts-v4/utils/Strings.sol"; import { SuperTokenV1Library } from "../../../contracts/apps/SuperTokenV1Library.sol"; import { PoolNFTBaseStorageLayoutMock, diff --git a/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTMock.t.sol b/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTMock.t.sol index 04110c4a7c..c8345b0cfd 100644 --- a/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTMock.t.sol +++ b/packages/ethereum-contracts/test/foundry/superfluid/PoolNFTMock.t.sol @@ -2,7 +2,7 @@ // solhint-disable reason-string pragma solidity ^0.8.23; -import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; +import { Strings } from "@openzeppelin/contracts-v4/utils/Strings.sol"; import { IGeneralDistributionAgreementV1, ISuperfluid diff --git a/packages/ethereum-contracts/test/foundry/superfluid/Superfluid.BatchCall.t.sol b/packages/ethereum-contracts/test/foundry/superfluid/Superfluid.BatchCall.t.sol index 90e3426610..dd615b204a 100644 --- a/packages/ethereum-contracts/test/foundry/superfluid/Superfluid.BatchCall.t.sol +++ b/packages/ethereum-contracts/test/foundry/superfluid/Superfluid.BatchCall.t.sol @@ -12,7 +12,7 @@ import { SuperTokenV1Library } from "../../../contracts/apps/SuperTokenV1Library import { SuperAppMock } from "../../../contracts/mocks/SuperAppMocks.t.sol"; import { SimpleForwarder } from "../../../contracts/utils/SimpleForwarder.sol"; import { ERC2771Forwarder } from "../../../contracts/utils/ERC2771Forwarder.sol"; -import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol'; +import { Ownable } from '@openzeppelin/contracts-v4/access/Ownable.sol'; import { BaseRelayRecipient } from "../../../contracts/libs/BaseRelayRecipient.sol"; // A mock for an arbitrary external contract diff --git a/packages/ethereum-contracts/test/foundry/utils/TOGA.t.sol b/packages/ethereum-contracts/test/foundry/utils/TOGA.t.sol index 51c7bda1e5..30d7447634 100644 --- a/packages/ethereum-contracts/test/foundry/utils/TOGA.t.sol +++ b/packages/ethereum-contracts/test/foundry/utils/TOGA.t.sol @@ -5,8 +5,8 @@ import "forge-std/Test.sol"; import { FoundrySuperfluidTester, SuperTokenV1Library } from "../FoundrySuperfluidTester.t.sol"; import { ISuperToken } from "../../../contracts/superfluid/SuperToken.sol"; import { TOGA } from "../../../contracts/utils/TOGA.sol"; -import { IERC1820Registry } from "@openzeppelin/contracts/interfaces/IERC1820Registry.sol"; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { IERC1820Registry } from "@openzeppelin/contracts-v4/interfaces/IERC1820Registry.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; import { TestToken } from "../../../contracts/utils/TestToken.sol"; /** diff --git a/yarn.lock b/yarn.lock index 584c5423e4..5f6a2c029e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3318,6 +3318,11 @@ find-up "^4.1.0" fs-extra "^8.1.0" +"@openzeppelin/contracts-v4@npm:@openzeppelin/contracts@4.9.6": + version "4.9.6" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.6.tgz#2a880a24eb19b4f8b25adc2a5095f2aa27f39677" + integrity sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA== + "@openzeppelin/contracts@4.9.6", "@openzeppelin/contracts@^4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.6.tgz#2a880a24eb19b4f8b25adc2a5095f2aa27f39677" From 16165d2515d517d1d7b7ee2ef8f7fe56ee44bc6a Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 11 Mar 2025 18:08:03 +0100 Subject: [PATCH 2/9] more specific mappings --- packages/ethereum-contracts/foundry.toml | 2 +- packages/solidity-semantic-money/foundry.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ethereum-contracts/foundry.toml b/packages/ethereum-contracts/foundry.toml index 0d39459284..e6ce533128 100644 --- a/packages/ethereum-contracts/foundry.toml +++ b/packages/ethereum-contracts/foundry.toml @@ -14,7 +14,7 @@ optimizer_runs = 200 remappings = [ '@superfluid-finance/ethereum-contracts/contracts/=packages/ethereum-contracts/contracts/', '@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/', - '@openzeppelin/=node_modules/@openzeppelin/', + '@openzeppelin/contracts-v4/=node_modules/@openzeppelin/contracts-v4/', 'ds-test/=lib/forge-std/lib/ds-test/src/', 'forge-std/=lib/forge-std/src/'] out = 'packages/ethereum-contracts/build/foundry/default' diff --git a/packages/solidity-semantic-money/foundry.toml b/packages/solidity-semantic-money/foundry.toml index f7b6d1bbd8..e00eed9ddb 100644 --- a/packages/solidity-semantic-money/foundry.toml +++ b/packages/solidity-semantic-money/foundry.toml @@ -11,7 +11,7 @@ optimizer_runs = 200 via_ir = false remappings = [ '@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/', - '@openzeppelin/=node_modules/@openzeppelin/', + '@openzeppelin/contracts-v4/=node_modules/@openzeppelin/contracts-v4/', 'ds-test/=lib/forge-std/lib/ds-test/src/', 'forge-std/=lib/forge-std/src/'] From 154300dfbed91d2d01ab33f0ce84288c3bef5781 Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 11 Mar 2025 18:34:49 +0100 Subject: [PATCH 3/9] more specific mappings --- packages/hot-fuzz/foundry.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hot-fuzz/foundry.toml b/packages/hot-fuzz/foundry.toml index 1571e85714..eda6857c62 100644 --- a/packages/hot-fuzz/foundry.toml +++ b/packages/hot-fuzz/foundry.toml @@ -8,7 +8,7 @@ optimizer_runs = 200 remappings = [ '@superfluid-finance/ethereum-contracts/contracts/=packages/ethereum-contracts/contracts/', '@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/', - '@openzeppelin/=node_modules/@openzeppelin/', + '@openzeppelin/contracts-v4/=node_modules/@openzeppelin/contracts-v4/', 'ds-test/=lib/forge-std/lib/ds-test/src/', 'forge-std/=lib/forge-std/src/'] out = 'packages/hot-fuzz/build/foundry/out' From e916ae6723b9a5a283518b7cadaaee3b8cb5df4a Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 11 Mar 2025 19:37:15 +0100 Subject: [PATCH 4/9] also adjust semantic-money --- packages/ethereum-contracts/CHANGELOG.md | 31 +++++++++++++++++++ .../src/ref-impl/ToySuperToken.sol | 4 +-- .../src/ref-impl/ToySuperfluidPool.sol | 2 +- .../src/ref-impl/ToySuperfluidToken.sol | 4 +-- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/packages/ethereum-contracts/CHANGELOG.md b/packages/ethereum-contracts/CHANGELOG.md index 80a0de65cc..4958b8dc84 100644 --- a/packages/ethereum-contracts/CHANGELOG.md +++ b/packages/ethereum-contracts/CHANGELOG.md @@ -3,6 +3,37 @@ All notable changes to the ethereum-contracts will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.13.0] + +### Breaking + +The npm dependency @openzeppelin/contracts is now mapped to the local path `@openzeppelin/contracts-v4`. +This frees up the default path `@openzeppelin/contracts` for v5 which most new Solidity projects use. + +In order to use this package in a **foundry project (new or existing) with dependencies installed as git submodules**, this steps are recommended: + +1. Add openzeppelin-contracts v4 as a submodule: +``` +git submodule add -b release-v4.9 https://github.com/OpenZeppelin/openzeppelin-contracts lib/openzeppelin-contracts-v4 +``` +Note the explicit local path with v4 postfix. + +2. Add this mapping to `foundry.toml` or `remappings.txt` (depending on where they are located in your project): +``` +"@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/" +``` + +That way, projects can use the import path `@openzeppelin/contracts` for openzeppelin v5. This is the default when using npm for installing the openzeppelin dependency. + +**Note:** +foundry by default auto-detects mappings based on the contents of the lib directory and nested foundry configuration files. +Because of this, it may automatically add a mapping `openzeppelin/=lib/openzeppelin-contracts-v4/contracts/` . +In case you're using the import path `openzeppelin/...` in your project, that may not be what you want. +In this case you can either change the import path to something else, or you can disable mapping auto-detection with `auto_detect_remappings = false` (see [docs](https://book.getfoundry.sh/reference/config/solidity-compiler#auto_detect_remappings)). If you disable it, you may need to explicitly add some mappings, e.g. for forge-std. + +In order to use this package in a **project with dependencies managed by npm packages**, you don't need to do anything. +Except: if you relied on the openzeppelin-contracts v4 dependency installed by this package, you now need to either also adjust the import path, or explicity add the dependency with the default path to your project. + ## [v1.12.1] ### Added diff --git a/packages/solidity-semantic-money/src/ref-impl/ToySuperToken.sol b/packages/solidity-semantic-money/src/ref-impl/ToySuperToken.sol index 074eb05147..9d1b6dbcbb 100644 --- a/packages/solidity-semantic-money/src/ref-impl/ToySuperToken.sol +++ b/packages/solidity-semantic-money/src/ref-impl/ToySuperToken.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.23; // solhint-disable not-rely-on-time -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import { Time, Value, FlowRate, diff --git a/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidPool.sol b/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidPool.sol index ab23129214..2c91ffe0a5 100644 --- a/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidPool.sol +++ b/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidPool.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.23; // solhint-disable not-rely-on-time -import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import { Initializable } from "@openzeppelin/contracts-v4/proxy/utils/Initializable.sol"; import { Time, Value, FlowRate, Unit, BasicParticle, diff --git a/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidToken.sol b/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidToken.sol index 5c999ae717..2a7e7bfaa9 100644 --- a/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidToken.sol +++ b/packages/solidity-semantic-money/src/ref-impl/ToySuperfluidToken.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.23; // solhint-disable not-rely-on-time -import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; -import { Clones } from "@openzeppelin/contracts/proxy/Clones.sol"; +import { EnumerableSet } from "@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol"; +import { Clones } from "@openzeppelin/contracts-v4/proxy/Clones.sol"; import { FlowId, ISuperfluidToken } from "./ISuperfluidToken.sol"; import { Time, Value, FlowRate, From a669477e08cc44b0257bebaf2ee156c0c27fef4f Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 11 Mar 2025 21:12:10 +0100 Subject: [PATCH 5/9] automation contracts too --- packages/automation-contracts/autowrap/contracts/Manager.sol | 2 +- .../autowrap/contracts/interfaces/IERC20Mod.sol | 2 +- .../autowrap/contracts/mocks/MockERC20.sol | 2 +- .../autowrap/contracts/strategies/StrategyBase.sol | 4 ++-- .../autowrap/contracts/strategies/WrapStrategy.sol | 2 +- .../scheduler/contracts/VestingSchedulerV2.sol | 4 ++-- .../scheduler/test/VestingSchedulerV2.t.sol | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/automation-contracts/autowrap/contracts/Manager.sol b/packages/automation-contracts/autowrap/contracts/Manager.sol index 50e6a3d603..217c78ebfe 100644 --- a/packages/automation-contracts/autowrap/contracts/Manager.sol +++ b/packages/automation-contracts/autowrap/contracts/Manager.sol @@ -7,7 +7,7 @@ import { IConstantFlowAgreementV1 } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; import { IERC20Mod } from "./interfaces/IERC20Mod.sol"; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; import { IManager } from "./interfaces/IManager.sol"; import { IStrategy } from "./interfaces/IStrategy.sol"; diff --git a/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol b/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol index 19c4d83e5a..60bd7752be 100644 --- a/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol +++ b/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; interface IERC20Mod is IERC20 { function decimals() external view returns (uint8); diff --git a/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol b/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol index 0fa6fa73c5..fabce5ea9a 100644 --- a/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol +++ b/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {ERC20} from "@openzeppelin/contracts-v4/token/ERC20/ERC20.sol"; contract MockERC20 is ERC20 { diff --git a/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol b/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol index ffd3902005..d7f9ed0c7f 100644 --- a/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol +++ b/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; -import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; +import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import { IERC20Mod } from "../interfaces/IERC20Mod.sol"; import { IStrategy } from "../interfaces/IStrategy.sol"; diff --git a/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol b/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol index 84603283dc..05b9cee98c 100644 --- a/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol +++ b/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import { ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; diff --git a/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol b/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol index dce469187b..731da67e72 100644 --- a/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol +++ b/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol @@ -7,8 +7,8 @@ import { import { SuperAppBase } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperAppBase.sol"; import { SuperTokenV1Library } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol"; import { IVestingSchedulerV2 } from "./interface/IVestingSchedulerV2.sol"; -import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeMath } from "@openzeppelin/contracts-v4/utils/math/SafeMath.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; contract VestingSchedulerV2 is IVestingSchedulerV2, SuperAppBase { diff --git a/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol b/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol index 2ad00c07b6..90719c2b12 100644 --- a/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol +++ b/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol @@ -7,8 +7,8 @@ import { IVestingSchedulerV2 } from "./../contracts/interface/IVestingSchedulerV import { VestingSchedulerV2 } from "./../contracts/VestingSchedulerV2.sol"; import { FoundrySuperfluidTester } from "@superfluid-finance/ethereum-contracts/test/foundry/FoundrySuperfluidTester.t.sol"; import { SuperTokenV1Library } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol"; -import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; -import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; +import { SafeMath } from "@openzeppelin/contracts-v4/utils/math/SafeMath.sol"; +import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; import "forge-std/console.sol"; /// @title VestingSchedulerTests From 9281a763c613932596ddea9ddf873b5328dafaa7 Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 11 Mar 2025 21:28:26 +0100 Subject: [PATCH 6/9] Revert "automation contracts too" This reverts commit a669477e08cc44b0257bebaf2ee156c0c27fef4f. --- packages/automation-contracts/autowrap/contracts/Manager.sol | 2 +- .../autowrap/contracts/interfaces/IERC20Mod.sol | 2 +- .../autowrap/contracts/mocks/MockERC20.sol | 2 +- .../autowrap/contracts/strategies/StrategyBase.sol | 4 ++-- .../autowrap/contracts/strategies/WrapStrategy.sol | 2 +- .../scheduler/contracts/VestingSchedulerV2.sol | 4 ++-- .../scheduler/test/VestingSchedulerV2.t.sol | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/automation-contracts/autowrap/contracts/Manager.sol b/packages/automation-contracts/autowrap/contracts/Manager.sol index 217c78ebfe..50e6a3d603 100644 --- a/packages/automation-contracts/autowrap/contracts/Manager.sol +++ b/packages/automation-contracts/autowrap/contracts/Manager.sol @@ -7,7 +7,7 @@ import { IConstantFlowAgreementV1 } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; import { IERC20Mod } from "./interfaces/IERC20Mod.sol"; -import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IManager } from "./interfaces/IManager.sol"; import { IStrategy } from "./interfaces/IStrategy.sol"; diff --git a/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol b/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol index 60bd7752be..19c4d83e5a 100644 --- a/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol +++ b/packages/automation-contracts/autowrap/contracts/interfaces/IERC20Mod.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IERC20Mod is IERC20 { function decimals() external view returns (uint8); diff --git a/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol b/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol index fabce5ea9a..0fa6fa73c5 100644 --- a/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol +++ b/packages/automation-contracts/autowrap/contracts/mocks/MockERC20.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import {ERC20} from "@openzeppelin/contracts-v4/token/ERC20/ERC20.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MockERC20 is ERC20 { diff --git a/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol b/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol index d7f9ed0c7f..ffd3902005 100644 --- a/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol +++ b/packages/automation-contracts/autowrap/contracts/strategies/StrategyBase.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol"; -import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IERC20Mod } from "../interfaces/IERC20Mod.sol"; import { IStrategy } from "../interfaces/IStrategy.sol"; diff --git a/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol b/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol index 05b9cee98c..84603283dc 100644 --- a/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol +++ b/packages/automation-contracts/autowrap/contracts/strategies/WrapStrategy.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; -import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; +import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; diff --git a/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol b/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol index 731da67e72..dce469187b 100644 --- a/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol +++ b/packages/automation-contracts/scheduler/contracts/VestingSchedulerV2.sol @@ -7,8 +7,8 @@ import { import { SuperAppBase } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperAppBase.sol"; import { SuperTokenV1Library } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol"; import { IVestingSchedulerV2 } from "./interface/IVestingSchedulerV2.sol"; -import { SafeMath } from "@openzeppelin/contracts-v4/utils/math/SafeMath.sol"; -import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; +import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; contract VestingSchedulerV2 is IVestingSchedulerV2, SuperAppBase { diff --git a/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol b/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol index 90719c2b12..2ad00c07b6 100644 --- a/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol +++ b/packages/automation-contracts/scheduler/test/VestingSchedulerV2.t.sol @@ -7,8 +7,8 @@ import { IVestingSchedulerV2 } from "./../contracts/interface/IVestingSchedulerV import { VestingSchedulerV2 } from "./../contracts/VestingSchedulerV2.sol"; import { FoundrySuperfluidTester } from "@superfluid-finance/ethereum-contracts/test/foundry/FoundrySuperfluidTester.t.sol"; import { SuperTokenV1Library } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol"; -import { SafeMath } from "@openzeppelin/contracts-v4/utils/math/SafeMath.sol"; -import { SafeCast } from "@openzeppelin/contracts-v4/utils/math/SafeCast.sol"; +import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "forge-std/console.sol"; /// @title VestingSchedulerTests From eafa5a1bf3915fb39f2ade6ba8979625a54f3188 Mon Sep 17 00:00:00 2001 From: didi Date: Wed, 12 Mar 2025 16:36:19 +0100 Subject: [PATCH 7/9] updated readme, automation-contracts mappings --- .../autowrap/foundry.toml | 3 +- .../scheduler/foundry.toml | 3 +- packages/ethereum-contracts/CHANGELOG.md | 26 +++------- packages/ethereum-contracts/README.md | 48 +++++++++++++------ 4 files changed, 43 insertions(+), 37 deletions(-) diff --git a/packages/automation-contracts/autowrap/foundry.toml b/packages/automation-contracts/autowrap/foundry.toml index bdf6e6f602..ab13d27726 100644 --- a/packages/automation-contracts/autowrap/foundry.toml +++ b/packages/automation-contracts/autowrap/foundry.toml @@ -9,7 +9,8 @@ optimizer_runs = 200 remappings = [ '@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/', '@superfluid-finance/ethereum-contracts/=packages/ethereum-contracts/', - '@openzeppelin/=node_modules/@openzeppelin/', + '@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/', + '@openzeppelin/contracts-v4/=node_modules/@openzeppelin/contracts-v4/', 'ds-test/=lib/forge-std/lib/ds-test/src/', 'forge-std/=lib/forge-std/src/'] out = 'packages/automation-contracts/autowrap/out/default' diff --git a/packages/automation-contracts/scheduler/foundry.toml b/packages/automation-contracts/scheduler/foundry.toml index 33fe841026..c9eff3939d 100644 --- a/packages/automation-contracts/scheduler/foundry.toml +++ b/packages/automation-contracts/scheduler/foundry.toml @@ -9,7 +9,8 @@ optimizer_runs = 200 remappings = [ '@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/', '@superfluid-finance/ethereum-contracts/=packages/ethereum-contracts/', - '@openzeppelin/=node_modules/@openzeppelin/', + '@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/', + '@openzeppelin/contracts-v4/=node_modules/@openzeppelin/contracts-v4/', 'ds-test/=lib/forge-std/lib/ds-test/src/', 'forge-std/=lib/forge-std/src/'] out = 'packages/automation-contracts/scheduler/out/default' diff --git a/packages/ethereum-contracts/CHANGELOG.md b/packages/ethereum-contracts/CHANGELOG.md index 4958b8dc84..3cd7fd9f77 100644 --- a/packages/ethereum-contracts/CHANGELOG.md +++ b/packages/ethereum-contracts/CHANGELOG.md @@ -7,32 +7,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Breaking -The npm dependency @openzeppelin/contracts is now mapped to the local path `@openzeppelin/contracts-v4`. +The npm dependency @openzeppelin/contracts is now mapped to the path `@openzeppelin/contracts-v4`. This frees up the default path `@openzeppelin/contracts` for v5 which most new Solidity projects use. -In order to use this package in a **foundry project (new or existing) with dependencies installed as git submodules**, this steps are recommended: - -1. Add openzeppelin-contracts v4 as a submodule: -``` -git submodule add -b release-v4.9 https://github.com/OpenZeppelin/openzeppelin-contracts lib/openzeppelin-contracts-v4 +In an existing foundry project, you will need to add this remapping: ``` -Note the explicit local path with v4 postfix. - -2. Add this mapping to `foundry.toml` or `remappings.txt` (depending on where they are located in your project): +@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/ ``` -"@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/" -``` - -That way, projects can use the import path `@openzeppelin/contracts` for openzeppelin v5. This is the default when using npm for installing the openzeppelin dependency. -**Note:** -foundry by default auto-detects mappings based on the contents of the lib directory and nested foundry configuration files. -Because of this, it may automatically add a mapping `openzeppelin/=lib/openzeppelin-contracts-v4/contracts/` . -In case you're using the import path `openzeppelin/...` in your project, that may not be what you want. -In this case you can either change the import path to something else, or you can disable mapping auto-detection with `auto_detect_remappings = false` (see [docs](https://book.getfoundry.sh/reference/config/solidity-compiler#auto_detect_remappings)). If you disable it, you may need to explicitly add some mappings, e.g. for forge-std. +In an existing hardhat project, just update the package. +In this case, if you are using openzeppelin v4 in your own contracts too, you may want to also change the import paths to `@openzeppelin/contracts-v4/`. -In order to use this package in a **project with dependencies managed by npm packages**, you don't need to do anything. -Except: if you relied on the openzeppelin-contracts v4 dependency installed by this package, you now need to either also adjust the import path, or explicity add the dependency with the default path to your project. +For more details, consult the updated `README.md` (section _Installation_).^ ## [v1.12.1] diff --git a/packages/ethereum-contracts/README.md b/packages/ethereum-contracts/README.md index c8e48c9f81..e4baa48e8d 100644 --- a/packages/ethereum-contracts/README.md +++ b/packages/ethereum-contracts/README.md @@ -28,40 +28,58 @@ ## Usage -If you're building a dapp using existing protocol or Super Token contracts, then you should use [`@superfluid-finance/sdk-core`](/packages/sdk-core). [Here](https://docs.superfluid.finance/superfluid/networks/networks) you can find a list of networks where the Superfluid protocol is already deployed. - -If you're building a smart contract that uses Superfluid protocol, or even your own [SuperApp](https://docs.superfluid.finance/), then great! This is definitely the place to be. +[Here](https://explorer.superfluid.org/protocol) you can find a list of networks where the Superfluid protocol is already deployed. ### Installation -Prerequisites: -- [node.js v18+](https://nodejs.org/en/download). The project recommends 22, and is tested with node 18,20,22. -- [yarn](https://classic.yarnpkg.com/en/docs/install) +Once you have set up your project, cd into its base directory and add the npm package: + +##### foundry + +**Prerequisites:** - [forge](https://book.getfoundry.sh/getting-started/installation) -Once you have set up your project, cd into its base directory and add the npm package: +**Install dependencies:** +```sh +forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@dev --no-commit +forge install openzeppelin-contracts-v4=https://github.com/OpenZeppelin/openzeppelin-contracts@release-v4.9 --no-commit +``` -##### hardhat +**Set up remappings:** ```sh -$ yarn add @superfluid-finance/ethereum-contracts +echo -e "@superfluid-finance/=lib/superfluid-protocol-monorepo/packages/\n@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/" >> remappings.txt ``` -##### foundry +If you want to use **openzeppelin v4** in your project's contracts, you should either: +- use the custom import path `@openzeppelin/contracts-v4` in your contracts +or +- add a remapping for the default import path: `@openzeppelin/contracts/=lib/openzeppelin-contracts-v4/contracts/` + +If you want to use **openzeppelin v5** in your project's contracts, you can use it alongside the v4 needed by Superfluid. + +##### hardhat +**Prerequisites:** +- [node.js v18+](https://nodejs.org/en/download). The project recommends v22, and is tested with versions 18,20,22. +- [yarn](https://classic.yarnpkg.com/en/docs/install) or any other node package manager of your choice. + +**Install dependencies:** ```sh -$ forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@dev -$ # or using ethereum-contracts@v1.6.0 -$ forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@$(git ls-remote https://github.com/superfluid-finance/protocol-monorepo.git ethereum-contracts@v1.6.0 | awk '{print $1}') +$ yarn add @superfluid-finance/ethereum-contracts ``` +If you want to use **openzeppelin v4** in your project's contracts, we recommend using the package installed as a nested dependency of this package, using the import path `@openzeppelin/contracts-v4/`. + +If you want to use **openzeppelin v5** in your project's contracts, you need to add the dependency yourself and can use it at the default import path `@openzeppelin/contracts/`. + ### Smart Contract You can then import Superfluid interfaces or contracts into your contracts like this: ```js -import { IConstantFlowAgreementV1 } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol"; +import { IConstantFlowAgreementV1 } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; ``` -The paths in the npm package are the same as in this repository. +(Most interfaces belonging to the Superfluid protocol can be imported from `ISuperfluid.sol`) ### Writing Tests From 56c74a660969adf3d0fdca03e06dc0eff34c71f0 Mon Sep 17 00:00:00 2001 From: didi Date: Wed, 12 Mar 2025 16:39:01 +0100 Subject: [PATCH 8/9] formatting --- packages/ethereum-contracts/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/ethereum-contracts/README.md b/packages/ethereum-contracts/README.md index e4baa48e8d..12bd00e0ea 100644 --- a/packages/ethereum-contracts/README.md +++ b/packages/ethereum-contracts/README.md @@ -36,16 +36,16 @@ Once you have set up your project, cd into its base directory and add the npm pa ##### foundry -**Prerequisites:** +Prerequisites: - [forge](https://book.getfoundry.sh/getting-started/installation) -**Install dependencies:** +Install dependencies: ```sh forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@dev --no-commit forge install openzeppelin-contracts-v4=https://github.com/OpenZeppelin/openzeppelin-contracts@release-v4.9 --no-commit ``` -**Set up remappings:** +Set up remappings: ```sh echo -e "@superfluid-finance/=lib/superfluid-protocol-monorepo/packages/\n@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/" >> remappings.txt ``` @@ -59,13 +59,13 @@ If you want to use **openzeppelin v5** in your project's contracts, you can use ##### hardhat -**Prerequisites:** +Prerequisites: - [node.js v18+](https://nodejs.org/en/download). The project recommends v22, and is tested with versions 18,20,22. - [yarn](https://classic.yarnpkg.com/en/docs/install) or any other node package manager of your choice. -**Install dependencies:** +Install dependencies: ```sh -$ yarn add @superfluid-finance/ethereum-contracts +yarn add @superfluid-finance/ethereum-contracts ``` If you want to use **openzeppelin v4** in your project's contracts, we recommend using the package installed as a nested dependency of this package, using the import path `@openzeppelin/contracts-v4/`. From 92d819b72340df65177850817864ecebc643453f Mon Sep 17 00:00:00 2001 From: didi Date: Wed, 12 Mar 2025 20:11:30 +0100 Subject: [PATCH 9/9] fix title hierarchy --- packages/ethereum-contracts/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ethereum-contracts/README.md b/packages/ethereum-contracts/README.md index 12bd00e0ea..9d94a0e7f5 100644 --- a/packages/ethereum-contracts/README.md +++ b/packages/ethereum-contracts/README.md @@ -34,7 +34,7 @@ Once you have set up your project, cd into its base directory and add the npm package: -##### foundry +#### foundry Prerequisites: - [forge](https://book.getfoundry.sh/getting-started/installation) @@ -57,7 +57,7 @@ or If you want to use **openzeppelin v5** in your project's contracts, you can use it alongside the v4 needed by Superfluid. -##### hardhat +#### hardhat Prerequisites: - [node.js v18+](https://nodejs.org/en/download). The project recommends v22, and is tested with versions 18,20,22.