From 8c25e9dcca9b9555175b8cc9c5ff487d4d6e13d0 Mon Sep 17 00:00:00 2001 From: Arr00 <13561405+arr00@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:02:37 -0400 Subject: [PATCH 1/3] wip --- scripts/maximize-pragma.js | 119 +++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 scripts/maximize-pragma.js diff --git a/scripts/maximize-pragma.js b/scripts/maximize-pragma.js new file mode 100644 index 00000000000..89ff3165b5e --- /dev/null +++ b/scripts/maximize-pragma.js @@ -0,0 +1,119 @@ +const { exec } = require('child_process'); +const fs = require('fs'); +const { hideBin } = require('yargs/helpers'); +const { argv } = require('yargs/yargs')(hideBin(process.argv)).positional('file', { + type: 'string', + describe: 'The contract to set pragma for', +}); + +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; +}); + +temp('contracts/interfaces/IERC721.sol'); + +async function main() { + console.log(await Promise.all(allSolcVersions.map(version => compileWithVersion(argv.file, version)))); +} + +async function getApplicablePragmas(file) { + const pragmas = await Promise.all(allSolcVersions.map(version => compileWithVersion(file, version))); + return pragmas; +} + +async function temp(file) { + const sources = getFileSources(file); + + console.log(mergePragmaLists(await getApplicablePragmas(file), await getParentApplicablePragmas(sources))); +} + +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 updateAllInterfacePragmas(newPragma) { + const dirPath = 'contracts/interfaces'; + const files = fs.readdirSync(dirPath); + for (const file of files) { + if (!file.endsWith('.sol')) { + continue; + } + await updatePragmaWithDependencies(`${dirPath}/${file}`, newPragma); + } +} + +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); +} + +async function updatePragma(file, newPragma) { + 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}`); +} + +async function updatePragmaWithDependencies(file, newPragma) { + updatePragma(file, newPragma); + + const sources = getFileSources(file); + + for (const source of sources) { + if (source !== file && !source.split('.').at(-1).startsWith('draft')) { + 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; +} From 01938f99ccf6460014988029266cdd0b83cc2e7b Mon Sep 17 00:00:00 2001 From: Arr00 <13561405+arr00@users.noreply.github.com> Date: Fri, 25 Apr 2025 16:24:39 -0400 Subject: [PATCH 2/3] update interface pragmas --- contracts/governance/utils/IVotes.sol | 2 +- contracts/interfaces/IERC1155.sol | 2 +- contracts/interfaces/IERC1155MetadataURI.sol | 2 +- contracts/interfaces/IERC1155Receiver.sol | 2 +- contracts/interfaces/IERC1271.sol | 2 +- contracts/interfaces/IERC1363.sol | 2 +- contracts/interfaces/IERC1363Receiver.sol | 2 +- contracts/interfaces/IERC1363Spender.sol | 2 +- contracts/interfaces/IERC165.sol | 2 +- contracts/interfaces/IERC1820Implementer.sol | 2 +- contracts/interfaces/IERC1820Registry.sol | 2 +- contracts/interfaces/IERC1967.sol | 2 +- contracts/interfaces/IERC20.sol | 2 +- contracts/interfaces/IERC20Metadata.sol | 2 +- contracts/interfaces/IERC2309.sol | 2 +- contracts/interfaces/IERC2612.sol | 2 +- contracts/interfaces/IERC2981.sol | 2 +- contracts/interfaces/IERC3156.sol | 2 +- .../interfaces/IERC3156FlashBorrower.sol | 2 +- contracts/interfaces/IERC3156FlashLender.sol | 2 +- contracts/interfaces/IERC4626.sol | 2 +- contracts/interfaces/IERC4906.sol | 2 +- contracts/interfaces/IERC5267.sol | 2 +- contracts/interfaces/IERC5313.sol | 2 +- contracts/interfaces/IERC5805.sol | 2 +- contracts/interfaces/IERC6372.sol | 2 +- contracts/interfaces/IERC721.sol | 2 +- contracts/interfaces/IERC721Enumerable.sol | 2 +- contracts/interfaces/IERC721Metadata.sol | 2 +- contracts/interfaces/IERC721Receiver.sol | 2 +- contracts/interfaces/IERC777.sol | 2 +- contracts/interfaces/IERC777Recipient.sol | 2 +- contracts/interfaces/IERC777Sender.sol | 2 +- contracts/token/ERC1155/IERC1155.sol | 2 +- contracts/token/ERC1155/IERC1155Receiver.sol | 2 +- .../extensions/IERC1155MetadataURI.sol | 2 +- contracts/token/ERC20/IERC20.sol | 2 +- .../token/ERC20/extensions/IERC20Metadata.sol | 2 +- .../token/ERC20/extensions/IERC20Permit.sol | 2 +- contracts/token/ERC721/IERC721.sol | 2 +- contracts/token/ERC721/IERC721Receiver.sol | 2 +- .../ERC721/extensions/IERC721Enumerable.sol | 2 +- .../ERC721/extensions/IERC721Metadata.sol | 2 +- contracts/utils/introspection/IERC165.sol | 2 +- ...{maximize-pragma.js => minimize-pragma.js} | 60 +++++++++++++------ 45 files changed, 86 insertions(+), 62 deletions(-) rename scripts/{maximize-pragma.js => minimize-pragma.js} (70%) diff --git a/contracts/governance/utils/IVotes.sol b/contracts/governance/utils/IVotes.sol index 7ba012e6791..c2cf4bdfe42 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..dc6571b7822 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..ad0d2fe2d0d 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..351393f0e21 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..7e54c8d45e5 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..db1e363ffeb 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..e5caa8971b9 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..8c46453768b 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..d55fcd87f17 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..5f446ba4ff2 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..6dd29d42d25 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..46e0113aac5 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..94f3f748a2e 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..27450e1ca88 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..bcfe736c990 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..6cde2d9043c 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..da31fa3e3ab 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..b9cdcc0957d 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..cb6602b0cdd 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..19fedbf247c 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..b314095f0d8 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..549b0c785cb 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..b2e68402c01 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..af316bd4b57 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..26e2e743dbf 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..63ec6bcaf58 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..f5e7b14c1aa 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..97dc38c989d 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..0aa49caabb8 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..c90113deff2 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..a7e852c63c6 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..5d222eb0eea 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..175161ee22b 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..9462e9b3108 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..5ff63cc8632 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..571f4d7c094 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..9101431ac6a 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..faa94fa572e 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..6340c9eb727 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..26610a6947e 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..1748a3766f5 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..9edc3e67f37 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..911f54ba7b5 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..38aee2af63f 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/maximize-pragma.js b/scripts/minimize-pragma.js similarity index 70% rename from scripts/maximize-pragma.js rename to scripts/minimize-pragma.js index 89ff3165b5e..50a2991378e 100644 --- a/scripts/maximize-pragma.js +++ b/scripts/minimize-pragma.js @@ -1,10 +1,5 @@ const { exec } = require('child_process'); const fs = require('fs'); -const { hideBin } = require('yargs/helpers'); -const { argv } = require('yargs/yargs')(hideBin(process.argv)).positional('file', { - type: 'string', - describe: 'The contract to set pragma for', -}); let solcVersionsMaxPatch = ['0.5.16', '0.6.12', '0.7.6', '0.8.29']; const allSolcVersions = solcVersionsMaxPatch.flatMap(minorVersion => { @@ -17,21 +12,48 @@ const allSolcVersions = solcVersionsMaxPatch.flatMap(minorVersion => { return patchVersions; }); -temp('contracts/interfaces/IERC721.sol'); +let finalizedFiles = []; -async function main() { - console.log(await Promise.all(allSolcVersions.map(version => compileWithVersion(argv.file, version)))); -} +minimizeAllInterfacePragmas(); async function getApplicablePragmas(file) { const pragmas = await Promise.all(allSolcVersions.map(version => compileWithVersion(file, version))); return pragmas; } -async function temp(file) { +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(mergePragmaLists(await getApplicablePragmas(file), await getParentApplicablePragmas(sources))); + console.log(`Finalized pragma in ${file} to ${newPragma}`); + finalizedFiles.push(file); } async function getParentApplicablePragmas(parents) { @@ -57,14 +79,14 @@ async function compileWithVersion(file, solcVersion) { }); } -async function updateAllInterfacePragmas(newPragma) { +async function minimizeAllInterfacePragmas() { const dirPath = 'contracts/interfaces'; const files = fs.readdirSync(dirPath); for (const file of files) { - if (!file.endsWith('.sol')) { + if (!file.endsWith('.sol') || file.startsWith('draft')) { continue; } - await updatePragmaWithDependencies(`${dirPath}/${file}`, newPragma); + await minimizePragma(`${dirPath}/${file}`); } } @@ -82,22 +104,24 @@ function getFileSources(file) { return sources.filter(source => source !== file); } -async function updatePragma(file, newPragma) { +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}`); + console.log(`Updated pragma in ${file} to ${newPragma}`); } -async function updatePragmaWithDependencies(file, newPragma) { +async function updatePragmaWithDependencies(file, newPragma = '>=0.5.0') { updatePragma(file, newPragma); const sources = getFileSources(file); for (const source of sources) { - if (source !== file && !source.split('.').at(-1).startsWith('draft')) { + if (source !== file) { await updatePragmaWithDependencies(source, newPragma); } } From 801edd10b7596cb61dd5b1548bcec8cd855ec1b5 Mon Sep 17 00:00:00 2001 From: Arr00 <13561405+arr00@users.noreply.github.com> Date: Fri, 25 Apr 2025 16:42:04 -0400 Subject: [PATCH 3/3] fix lint --- contracts/governance/utils/IVotes.sol | 2 +- contracts/interfaces/IERC1155.sol | 2 +- contracts/interfaces/IERC1155MetadataURI.sol | 2 +- contracts/interfaces/IERC1155Receiver.sol | 2 +- contracts/interfaces/IERC1271.sol | 2 +- contracts/interfaces/IERC1363.sol | 2 +- contracts/interfaces/IERC1363Receiver.sol | 2 +- contracts/interfaces/IERC1363Spender.sol | 2 +- contracts/interfaces/IERC165.sol | 2 +- contracts/interfaces/IERC1820Implementer.sol | 2 +- contracts/interfaces/IERC1820Registry.sol | 2 +- contracts/interfaces/IERC1967.sol | 2 +- contracts/interfaces/IERC20.sol | 2 +- contracts/interfaces/IERC20Metadata.sol | 2 +- contracts/interfaces/IERC2309.sol | 2 +- contracts/interfaces/IERC2612.sol | 2 +- contracts/interfaces/IERC2981.sol | 2 +- contracts/interfaces/IERC3156.sol | 2 +- contracts/interfaces/IERC3156FlashBorrower.sol | 2 +- contracts/interfaces/IERC3156FlashLender.sol | 2 +- contracts/interfaces/IERC4626.sol | 2 +- contracts/interfaces/IERC4906.sol | 2 +- contracts/interfaces/IERC5267.sol | 2 +- contracts/interfaces/IERC5313.sol | 2 +- contracts/interfaces/IERC5805.sol | 2 +- contracts/interfaces/IERC6372.sol | 2 +- contracts/interfaces/IERC721.sol | 2 +- contracts/interfaces/IERC721Enumerable.sol | 2 +- contracts/interfaces/IERC721Metadata.sol | 2 +- contracts/interfaces/IERC721Receiver.sol | 2 +- contracts/interfaces/IERC777.sol | 2 +- contracts/interfaces/IERC777Recipient.sol | 2 +- contracts/interfaces/IERC777Sender.sol | 2 +- contracts/token/ERC1155/IERC1155.sol | 2 +- contracts/token/ERC1155/IERC1155Receiver.sol | 2 +- contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol | 2 +- contracts/token/ERC20/IERC20.sol | 2 +- contracts/token/ERC20/extensions/IERC20Metadata.sol | 2 +- contracts/token/ERC20/extensions/IERC20Permit.sol | 2 +- contracts/token/ERC721/IERC721.sol | 2 +- contracts/token/ERC721/IERC721Receiver.sol | 2 +- contracts/token/ERC721/extensions/IERC721Enumerable.sol | 2 +- contracts/token/ERC721/extensions/IERC721Metadata.sol | 2 +- contracts/utils/introspection/IERC165.sol | 2 +- scripts/minimize-pragma.js | 2 +- 45 files changed, 45 insertions(+), 45 deletions(-) diff --git a/contracts/governance/utils/IVotes.sol b/contracts/governance/utils/IVotes.sol index c2cf4bdfe42..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.4; +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 dc6571b7822..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.6.2; +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 ad0d2fe2d0d..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.6.2; +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 351393f0e21..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.6.2; +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 7e54c8d45e5..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.6.9; +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 db1e363ffeb..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.6.2; +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 e5caa8971b9..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.5.0; +pragma solidity >=0.5.0; /** * @title IERC1363Receiver diff --git a/contracts/interfaces/IERC1363Spender.sol b/contracts/interfaces/IERC1363Spender.sol index 8c46453768b..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.5.0; +pragma solidity >=0.5.0; /** * @title IERC1363Spender diff --git a/contracts/interfaces/IERC165.sol b/contracts/interfaces/IERC165.sol index d55fcd87f17..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.5.0; +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 5f446ba4ff2..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.5.0; +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 6dd29d42d25..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.5.0; +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 46e0113aac5..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.5.0; +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 94f3f748a2e..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.5.0; +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 27450e1ca88..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.6.2; +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 bcfe736c990..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.5.0; +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 6cde2d9043c..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.6.2; +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 da31fa3e3ab..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.6.2; +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 b9cdcc0957d..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 cb6602b0cdd..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.5.0; +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 19fedbf247c..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.5.0; +pragma solidity >=0.5.0; import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol"; diff --git a/contracts/interfaces/IERC4626.sol b/contracts/interfaces/IERC4626.sol index b314095f0d8..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.6.2; +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 549b0c785cb..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.6.2; +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 b2e68402c01..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.5.0; +pragma solidity >=0.5.0; interface IERC5267 { /** diff --git a/contracts/interfaces/IERC5313.sol b/contracts/interfaces/IERC5313.sol index af316bd4b57..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.5.0; +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 26e2e743dbf..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.4; +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 63ec6bcaf58..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.5.0; +pragma solidity >=0.5.0; interface IERC6372 { /** diff --git a/contracts/interfaces/IERC721.sol b/contracts/interfaces/IERC721.sol index f5e7b14c1aa..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.6.2; +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 97dc38c989d..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.6.2; +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 0aa49caabb8..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.6.2; +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 c90113deff2..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.5.0; +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 a7e852c63c6..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.5.0; +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 5d222eb0eea..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.5.0; +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 175161ee22b..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.5.0; +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 9462e9b3108..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.6.2; +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 5ff63cc8632..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.6.2; +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 571f4d7c094..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.6.2; +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 9101431ac6a..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.5.0; +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 faa94fa572e..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.6.2; +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 6340c9eb727..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.5.0; +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 26610a6947e..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.6.2; +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 1748a3766f5..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.5.0; +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 9edc3e67f37..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.6.2; +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 911f54ba7b5..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.6.2; +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 38aee2af63f..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.5.0; +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 index 50a2991378e..9330077fcd2 100644 --- a/scripts/minimize-pragma.js +++ b/scripts/minimize-pragma.js @@ -41,7 +41,7 @@ async function minimizePragma(file) { const newPragma = applicablePragmas.reduce((accumulator, currentVal) => { if (currentVal.success && accumulator === '') { - return `>= ${currentVal.solcVersion}`; + return `>=${currentVal.solcVersion}`; } if (!currentVal.success && accumulator !== '') {