diff --git a/contracts/governance/utils/IVotes.sol b/contracts/governance/utils/IVotes.sol index 7ba012e6791..508e611a5b4 100644 --- a/contracts/governance/utils/IVotes.sol +++ b/contracts/governance/utils/IVotes.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (governance/utils/IVotes.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.8.4; /** * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. diff --git a/contracts/interfaces/IERC1155.sol b/contracts/interfaces/IERC1155.sol index bb502b1da88..4bda2dc904a 100644 --- a/contracts/interfaces/IERC1155.sol +++ b/contracts/interfaces/IERC1155.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1155.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC1155} from "../token/ERC1155/IERC1155.sol"; diff --git a/contracts/interfaces/IERC1155MetadataURI.sol b/contracts/interfaces/IERC1155MetadataURI.sol index dac0bab5457..ccef66cd6b9 100644 --- a/contracts/interfaces/IERC1155MetadataURI.sol +++ b/contracts/interfaces/IERC1155MetadataURI.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1155MetadataURI.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC1155MetadataURI} from "../token/ERC1155/extensions/IERC1155MetadataURI.sol"; diff --git a/contracts/interfaces/IERC1155Receiver.sol b/contracts/interfaces/IERC1155Receiver.sol index 6bb7c9684a3..fde303172ee 100644 --- a/contracts/interfaces/IERC1155Receiver.sol +++ b/contracts/interfaces/IERC1155Receiver.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1155Receiver.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC1155Receiver} from "../token/ERC1155/IERC1155Receiver.sol"; diff --git a/contracts/interfaces/IERC1271.sol b/contracts/interfaces/IERC1271.sol index 71e0b72b60a..1af9efd324a 100644 --- a/contracts/interfaces/IERC1271.sol +++ b/contracts/interfaces/IERC1271.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.3.0) (interfaces/IERC1271.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.9; /** * @dev Interface of the ERC-1271 standard signature validation method for diff --git a/contracts/interfaces/IERC1363.sol b/contracts/interfaces/IERC1363.sol index 02de2285997..ebfa76c3f36 100644 --- a/contracts/interfaces/IERC1363.sol +++ b/contracts/interfaces/IERC1363.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; diff --git a/contracts/interfaces/IERC1363Receiver.sol b/contracts/interfaces/IERC1363Receiver.sol index 02c065861cc..28ae5c751ed 100644 --- a/contracts/interfaces/IERC1363Receiver.sol +++ b/contracts/interfaces/IERC1363Receiver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363Receiver.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @title IERC1363Receiver diff --git a/contracts/interfaces/IERC1363Spender.sol b/contracts/interfaces/IERC1363Spender.sol index 13af938f066..7c1ce0c2d66 100644 --- a/contracts/interfaces/IERC1363Spender.sol +++ b/contracts/interfaces/IERC1363Spender.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363Spender.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @title IERC1363Spender diff --git a/contracts/interfaces/IERC165.sol b/contracts/interfaces/IERC165.sol index 944dd0d5912..93b84fbc8f7 100644 --- a/contracts/interfaces/IERC165.sol +++ b/contracts/interfaces/IERC165.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; import {IERC165} from "../utils/introspection/IERC165.sol"; diff --git a/contracts/interfaces/IERC1820Implementer.sol b/contracts/interfaces/IERC1820Implementer.sol index 95289c65cf4..9ccdc6fe04d 100644 --- a/contracts/interfaces/IERC1820Implementer.sol +++ b/contracts/interfaces/IERC1820Implementer.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1820Implementer.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface for an ERC-1820 implementer, as defined in the diff --git a/contracts/interfaces/IERC1820Registry.sol b/contracts/interfaces/IERC1820Registry.sol index fa70466114d..822be8b3b51 100644 --- a/contracts/interfaces/IERC1820Registry.sol +++ b/contracts/interfaces/IERC1820Registry.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1820Registry.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the global ERC-1820 Registry, as defined in the diff --git a/contracts/interfaces/IERC1967.sol b/contracts/interfaces/IERC1967.sol index d285ec889e8..dcecce7323d 100644 --- a/contracts/interfaces/IERC1967.sol +++ b/contracts/interfaces/IERC1967.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. diff --git a/contracts/interfaces/IERC20.sol b/contracts/interfaces/IERC20.sol index 21d5a413275..2eb70e81581 100644 --- a/contracts/interfaces/IERC20.sol +++ b/contracts/interfaces/IERC20.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; import {IERC20} from "../token/ERC20/IERC20.sol"; diff --git a/contracts/interfaces/IERC20Metadata.sol b/contracts/interfaces/IERC20Metadata.sol index b7bc6916f42..6a4d15a7ec9 100644 --- a/contracts/interfaces/IERC20Metadata.sol +++ b/contracts/interfaces/IERC20Metadata.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20Metadata.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol"; diff --git a/contracts/interfaces/IERC2309.sol b/contracts/interfaces/IERC2309.sol index aa00f341761..504a2945ff2 100644 --- a/contracts/interfaces/IERC2309.sol +++ b/contracts/interfaces/IERC2309.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2309.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev ERC-2309: ERC-721 Consecutive Transfer Extension. diff --git a/contracts/interfaces/IERC2612.sol b/contracts/interfaces/IERC2612.sol index c0427bbfdf5..03acefb3d49 100644 --- a/contracts/interfaces/IERC2612.sol +++ b/contracts/interfaces/IERC2612.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2612.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC20Permit} from "../token/ERC20/extensions/IERC20Permit.sol"; diff --git a/contracts/interfaces/IERC2981.sol b/contracts/interfaces/IERC2981.sol index db5eb5cd446..8b04bdd49f1 100644 --- a/contracts/interfaces/IERC2981.sol +++ b/contracts/interfaces/IERC2981.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC2981.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC165} from "../utils/introspection/IERC165.sol"; diff --git a/contracts/interfaces/IERC3156.sol b/contracts/interfaces/IERC3156.sol index 0f48bf38798..463f795c974 100644 --- a/contracts/interfaces/IERC3156.sol +++ b/contracts/interfaces/IERC3156.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC3156.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.8.20; import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol"; import {IERC3156FlashLender} from "./IERC3156FlashLender.sol"; diff --git a/contracts/interfaces/IERC3156FlashBorrower.sol b/contracts/interfaces/IERC3156FlashBorrower.sol index daafb17ee05..af1a8698cfd 100644 --- a/contracts/interfaces/IERC3156FlashBorrower.sol +++ b/contracts/interfaces/IERC3156FlashBorrower.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashBorrower.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-3156 FlashBorrower, as defined in diff --git a/contracts/interfaces/IERC3156FlashLender.sol b/contracts/interfaces/IERC3156FlashLender.sol index 7b1b071d4df..f0a004971ba 100644 --- a/contracts/interfaces/IERC3156FlashLender.sol +++ b/contracts/interfaces/IERC3156FlashLender.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashLender.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol"; diff --git a/contracts/interfaces/IERC4626.sol b/contracts/interfaces/IERC4626.sol index ce55f72e1f1..7d607ff51a1 100644 --- a/contracts/interfaces/IERC4626.sol +++ b/contracts/interfaces/IERC4626.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.3.0) (interfaces/IERC4626.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC20} from "../token/ERC20/IERC20.sol"; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol"; diff --git a/contracts/interfaces/IERC4906.sol b/contracts/interfaces/IERC4906.sol index 6ecd061347b..63260505f74 100644 --- a/contracts/interfaces/IERC4906.sol +++ b/contracts/interfaces/IERC4906.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC4906.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC165} from "./IERC165.sol"; import {IERC721} from "./IERC721.sol"; diff --git a/contracts/interfaces/IERC5267.sol b/contracts/interfaces/IERC5267.sol index 47a9fd58855..9471e48ef3a 100644 --- a/contracts/interfaces/IERC5267.sol +++ b/contracts/interfaces/IERC5267.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; interface IERC5267 { /** diff --git a/contracts/interfaces/IERC5313.sol b/contracts/interfaces/IERC5313.sol index 62f8d75c570..4478bad3222 100644 --- a/contracts/interfaces/IERC5313.sol +++ b/contracts/interfaces/IERC5313.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5313.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface for the Light Contract Ownership Standard. diff --git a/contracts/interfaces/IERC5805.sol b/contracts/interfaces/IERC5805.sol index a89e22df4a4..d73f8acc8f3 100644 --- a/contracts/interfaces/IERC5805.sol +++ b/contracts/interfaces/IERC5805.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5805.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.8.4; import {IVotes} from "../governance/utils/IVotes.sol"; import {IERC6372} from "./IERC6372.sol"; diff --git a/contracts/interfaces/IERC6372.sol b/contracts/interfaces/IERC6372.sol index 7d2ea4a5558..00d211935ca 100644 --- a/contracts/interfaces/IERC6372.sol +++ b/contracts/interfaces/IERC6372.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC6372.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; interface IERC6372 { /** diff --git a/contracts/interfaces/IERC721.sol b/contracts/interfaces/IERC721.sol index 0ea735bb320..7d36f3e8680 100644 --- a/contracts/interfaces/IERC721.sol +++ b/contracts/interfaces/IERC721.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC721} from "../token/ERC721/IERC721.sol"; diff --git a/contracts/interfaces/IERC721Enumerable.sol b/contracts/interfaces/IERC721Enumerable.sol index d83a056213c..f0b83646917 100644 --- a/contracts/interfaces/IERC721Enumerable.sol +++ b/contracts/interfaces/IERC721Enumerable.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721Enumerable.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC721Enumerable} from "../token/ERC721/extensions/IERC721Enumerable.sol"; diff --git a/contracts/interfaces/IERC721Metadata.sol b/contracts/interfaces/IERC721Metadata.sol index d79dd68694c..7ebdea2ec35 100644 --- a/contracts/interfaces/IERC721Metadata.sol +++ b/contracts/interfaces/IERC721Metadata.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721Metadata.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC721Metadata} from "../token/ERC721/extensions/IERC721Metadata.sol"; diff --git a/contracts/interfaces/IERC721Receiver.sol b/contracts/interfaces/IERC721Receiver.sol index 6b2a5aa6771..7094254a639 100644 --- a/contracts/interfaces/IERC721Receiver.sol +++ b/contracts/interfaces/IERC721Receiver.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721Receiver.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; import {IERC721Receiver} from "../token/ERC721/IERC721Receiver.sol"; diff --git a/contracts/interfaces/IERC777.sol b/contracts/interfaces/IERC777.sol index 1e672330a41..b3f5184fbf3 100644 --- a/contracts/interfaces/IERC777.sol +++ b/contracts/interfaces/IERC777.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC777.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-777 Token standard as defined in the ERC. diff --git a/contracts/interfaces/IERC777Recipient.sol b/contracts/interfaces/IERC777Recipient.sol index c377de971fc..99ade77c15e 100644 --- a/contracts/interfaces/IERC777Recipient.sol +++ b/contracts/interfaces/IERC777Recipient.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC777Recipient.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-777 Tokens Recipient standard as defined in the ERC. diff --git a/contracts/interfaces/IERC777Sender.sol b/contracts/interfaces/IERC777Sender.sol index 0ec8c278484..0086b82c994 100644 --- a/contracts/interfaces/IERC777Sender.sol +++ b/contracts/interfaces/IERC777Sender.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC777Sender.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-777 Tokens Sender standard as defined in the ERC. diff --git a/contracts/token/ERC1155/IERC1155.sol b/contracts/token/ERC1155/IERC1155.sol index ea1c0dabaec..70cdecd93f1 100644 --- a/contracts/token/ERC1155/IERC1155.sol +++ b/contracts/token/ERC1155/IERC1155.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.3.0) (token/ERC1155/IERC1155.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC165} from "../../utils/introspection/IERC165.sol"; diff --git a/contracts/token/ERC1155/IERC1155Receiver.sol b/contracts/token/ERC1155/IERC1155Receiver.sol index 7d9bc239719..22ac80aaf90 100644 --- a/contracts/token/ERC1155/IERC1155Receiver.sol +++ b/contracts/token/ERC1155/IERC1155Receiver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/IERC1155Receiver.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC165} from "../../utils/introspection/IERC165.sol"; diff --git a/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol b/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol index b413f4304d3..38fc6852a90 100644 --- a/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol +++ b/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC1155} from "../IERC1155.sol"; diff --git a/contracts/token/ERC20/IERC20.sol b/contracts/token/ERC20/IERC20.sol index 7d1019563f5..f6320eace8a 100644 --- a/contracts/token/ERC20/IERC20.sol +++ b/contracts/token/ERC20/IERC20.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-20 standard as defined in the ERC. diff --git a/contracts/token/ERC20/extensions/IERC20Metadata.sol b/contracts/token/ERC20/extensions/IERC20Metadata.sol index 3c067ef4012..dd9c9beb460 100644 --- a/contracts/token/ERC20/extensions/IERC20Metadata.sol +++ b/contracts/token/ERC20/extensions/IERC20Metadata.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC20} from "../IERC20.sol"; diff --git a/contracts/token/ERC20/extensions/IERC20Permit.sol b/contracts/token/ERC20/extensions/IERC20Permit.sol index fc374368fd2..d159e6b1f70 100644 --- a/contracts/token/ERC20/extensions/IERC20Permit.sol +++ b/contracts/token/ERC20/extensions/IERC20Permit.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Permit.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in diff --git a/contracts/token/ERC721/IERC721.sol b/contracts/token/ERC721/IERC721.sol index da393014753..61aaaab33b8 100644 --- a/contracts/token/ERC721/IERC721.sol +++ b/contracts/token/ERC721/IERC721.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC165} from "../../utils/introspection/IERC165.sol"; diff --git a/contracts/token/ERC721/IERC721Receiver.sol b/contracts/token/ERC721/IERC721Receiver.sol index d472eec338a..42c3fd12a18 100644 --- a/contracts/token/ERC721/IERC721Receiver.sol +++ b/contracts/token/ERC721/IERC721Receiver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721Receiver.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @title ERC-721 token receiver interface diff --git a/contracts/token/ERC721/extensions/IERC721Enumerable.sol b/contracts/token/ERC721/extensions/IERC721Enumerable.sol index 7a09cc6a094..e839243f6b8 100644 --- a/contracts/token/ERC721/extensions/IERC721Enumerable.sol +++ b/contracts/token/ERC721/extensions/IERC721Enumerable.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC721} from "../IERC721.sol"; diff --git a/contracts/token/ERC721/extensions/IERC721Metadata.sol b/contracts/token/ERC721/extensions/IERC721Metadata.sol index e9e00fab6e5..3c66d0feee4 100644 --- a/contracts/token/ERC721/extensions/IERC721Metadata.sol +++ b/contracts/token/ERC721/extensions/IERC721Metadata.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.6.2; import {IERC721} from "../IERC721.sol"; diff --git a/contracts/utils/introspection/IERC165.sol b/contracts/utils/introspection/IERC165.sol index 719ec358659..4aab4f4c09e 100644 --- a/contracts/utils/introspection/IERC165.sol +++ b/contracts/utils/introspection/IERC165.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) -pragma solidity ^0.8.20; +pragma solidity >=0.5.0; /** * @dev Interface of the ERC-165 standard, as defined in the diff --git a/scripts/minimize-pragma.js b/scripts/minimize-pragma.js new file mode 100644 index 00000000000..9330077fcd2 --- /dev/null +++ b/scripts/minimize-pragma.js @@ -0,0 +1,143 @@ +const { exec } = require('child_process'); +const fs = require('fs'); + +let solcVersionsMaxPatch = ['0.5.16', '0.6.12', '0.7.6', '0.8.29']; +const allSolcVersions = solcVersionsMaxPatch.flatMap(minorVersion => { + let patchVersions = []; + const maxPatchVersion = parseInt(minorVersion.split('.')[2]); + const minorVersionWithoutPatch = minorVersion.split('.').slice(0, 2).join('.'); + for (let i = 0; i <= maxPatchVersion; i++) { + patchVersions.push(`${minorVersionWithoutPatch}.${i}`); + } + return patchVersions; +}); + +let finalizedFiles = []; + +minimizeAllInterfacePragmas(); + +async function getApplicablePragmas(file) { + const pragmas = await Promise.all(allSolcVersions.map(version => compileWithVersion(file, version))); + return pragmas; +} + +async function minimizePragma(file) { + if (finalizedFiles.includes(file)) { + return; + } + + await updatePragmaWithDependencies(file); + + const sources = getFileSources(file); + for (const source of sources) { + console.log(source); + await minimizePragma(source); + } + + const applicablePragmas = mergePragmaLists( + await getApplicablePragmas(file), + await getParentApplicablePragmas(sources), + ); + + const newPragma = applicablePragmas.reduce((accumulator, currentVal) => { + if (currentVal.success && accumulator === '') { + return `>=${currentVal.solcVersion}`; + } + + if (!currentVal.success && accumulator !== '') { + throw new Error('Unexpected failing compilation'); + } + return accumulator; + }, ''); + + updatePragma(file, newPragma); + + console.log(`Finalized pragma in ${file} to ${newPragma}`); + finalizedFiles.push(file); +} + +async function getParentApplicablePragmas(parents) { + let pragmas; + for (const parent of parents) { + if (pragmas === undefined) { + pragmas = await getApplicablePragmas(parent); + } else { + pragmas = mergePragmaLists(pragmas, await getApplicablePragmas(parent)); + } + } + return pragmas; +} + +async function compileWithVersion(file, solcVersion) { + return new Promise(resolve => { + exec(`forge build ${file} --ast --use ${solcVersion} --out out/out-solc${solcVersion}`, error => { + if (error !== null) { + return resolve({ solcVersion, success: false }); + } + return resolve({ solcVersion, success: true }); + }); + }); +} + +async function minimizeAllInterfacePragmas() { + const dirPath = 'contracts/interfaces'; + const files = fs.readdirSync(dirPath); + for (const file of files) { + if (!file.endsWith('.sol') || file.startsWith('draft')) { + continue; + } + await minimizePragma(`${dirPath}/${file}`); + } +} + +function getFileSources(file) { + const contractName = file.split('/').at(-1); + + const jsonOutput = JSON.parse(fs.readFileSync(`out/${contractName}/${contractName.split('.')[0]}.json`)); + if (jsonOutput.metadata === undefined || jsonOutput.metadata.sources === undefined) { + return []; + } + + const sources = Object.keys( + JSON.parse(fs.readFileSync(`out/${contractName}/${contractName.split('.')[0]}.json`)).metadata.sources, + ); + return sources.filter(source => source !== file); +} + +function updatePragma(file, newPragma) { + if (finalizedFiles.includes(file)) return; + + let fileContent = fs.readFileSync(file, 'utf8').split('\n'); + const pragmaLineIndex = fileContent.findIndex(line => line.startsWith('pragma solidity')); + fileContent[pragmaLineIndex] = `pragma solidity ${newPragma};`; + + fs.writeFileSync(file, fileContent.join('\n'), 'utf8'); + console.log(`Updated pragma in ${file} to ${newPragma}`); +} + +async function updatePragmaWithDependencies(file, newPragma = '>=0.5.0') { + updatePragma(file, newPragma); + + const sources = getFileSources(file); + + for (const source of sources) { + if (source !== file) { + await updatePragmaWithDependencies(source, newPragma); + } + } +} + +function mergePragmaLists(pragmaList1, pragmaList2) { + if (pragmaList1 === undefined || pragmaList2 === undefined) return pragmaList1 ?? pragmaList2; + + let res = []; + + const versions = pragmaList1.map(item => item.solcVersion); + for (const version of versions) { + const success1 = pragmaList1.find(item => item.solcVersion === version)?.success; + const success2 = pragmaList2.find(item => item.solcVersion === version)?.success; + res.push({ solcVersion: version, success: (success1 ?? false) && (success2 ?? false) }); + } + + return res; +}