Skip to content

Commit

Permalink
feat: less restrictive solidity compiler pragmas (#480)
Browse files Browse the repository at this point in the history
* feat: made solc pragma less restrictive

* docs: use solc 0.8.21 in the examples
  • Loading branch information
heueristik authored Oct 6, 2023
1 parent 40a0206 commit 4accb52
Show file tree
Hide file tree
Showing 76 changed files with 84 additions and 83 deletions.
1 change: 1 addition & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Changed the solidity compiler pragma from `0.8.17` to `^0.8.8` for all files.
- Improved type safety by using `abi.encodeCall` instead of `abi.encodeWithSelector` and the more explicit bracket syntax for permissions.
- Bumped OpenZeppelin dependencies to `4.9.3`.
- Refactored the fallback in the `isGranted` function in `PermissionManager` to make conditions mutually exclusive: Specific conditions answering `false` do not fall back to generic caller conditions (`_who: ANY_ADDR`) or generic target conditions (`_where: ANY_ADDR`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In this case, the compiler will force you to write a `constructor` function call

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {Plugin, IDAO} from '@aragon/osx/core/plugin/Plugin.sol';
Expand Down Expand Up @@ -57,7 +57,7 @@ To deploy our plugin via the [minimal clones pattern (ERC-1167)](https://eips.et

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PluginCloneable, IDAO} from '@aragon/osx/core/plugin/PluginCloneable.sol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Each `PluginSetup` contract is deployed only once and we will publish a separate

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PluginSetup, IPluginSetup} from '@aragon/osx/framework/plugin/setup/PluginSetup.sol';
import {SimpleAdmin} from './SimpleAdmin.sol';
Expand Down Expand Up @@ -227,7 +227,7 @@ Now, it's time to wrap up everything together. You should have a contract that l

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {Clones} from '@openzeppelin/contracts/proxy/Clones.sol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Then, inside of the file, add the functionality:

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {Plugin, IDAO} from '@aragon/osx/core/plugin/Plugin.sol';
Expand Down Expand Up @@ -122,7 +122,7 @@ In the `prepareInstallation()` function here then, we will grant the `GREET_PERM

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PluginSetup} from '@aragon/osx/framework/plugin/setup/PluginSetup.sol';
import {PermissionLib} from '@aragon/osx/core/permission/PermissionLib.sol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This has to be called - otherwise, anyone else could call the plugin's initializ

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PluginUUPSUpgradeable, IDAO} '@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Before building the Plugin Setup contract, make sure you have the logic for your

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {IDAO, PluginUUPSUpgradeable} from '@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol';
Expand Down Expand Up @@ -53,7 +53,7 @@ Similarly, the `prepareUninstallation()` function takes in a `payload`.
```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PermissionLib} from '@aragon/osx/core/permission/PermissionLib.sol';
import {PluginSetup, IPluginSetup} from '@aragon/osx/framework/plugin/setup/PluginSetup.sol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Firstly, you want to create the new build implementation contract the plugin sho

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {IDAO, PluginUUPSUpgradeable} from '@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol';
Expand Down Expand Up @@ -61,7 +61,7 @@ In contrast to the original build 1, build 2 requires two input arguments: `uint
```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PermissionLib} from '@aragon/osx/core/permission/PermissionLib.sol';
import {PluginSetup, IPluginSetup} from '@aragon/osx/framework/plugin/setup/PluginSetup.sol';
Expand Down Expand Up @@ -159,7 +159,7 @@ In this third build, for example, we are modifying the bytecode of the plugin.

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {IDAO, PluginUUPSUpgradeable} from '@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol';
Expand Down Expand Up @@ -234,7 +234,7 @@ With each new build implementation, we will need to udate the Plugin Setup contr
```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PermissionLib} from '@aragon/osx/core/permission/PermissionLib.sol';
import {PluginSetup, IPluginSetup} from '@aragon/osx/framework/plugin/setup/PluginSetup.sol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Inside the `GreeterPlugin.sol`, we want to:

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {Plugin, IDAO} from '@aragon/osx/core/plugin/Plugin.sol';
Expand Down Expand Up @@ -105,7 +105,7 @@ Inside the file, we'll add the `prepareInstallation` and `prepareUninstallation`

```solidity
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {PermissionLib} from '@aragon/osx/core/permission/PermissionLib.sol';
import {PluginSetup} from '@aragon/osx/framework/plugin/setup/PluginSetup.sol';
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/docs/developer-portal/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Then, to use the contracts within your project, **import the contracts** through

```solidity title="MyCoolPlugin.sol"
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.21;
import {Plugin, IDAO} from '@aragon/osx/core/plugin/Plugin.sol';
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/core/dao/DAO.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/core/dao/IEIP4824.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

/// @title EIP-4824 Common Interfaces for DAOs
/// @dev See https://eips.ethereum.org/EIPS/eip-4824
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/core/utils/BitMap.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

/// @param bitmap The `uint256` representation of bits.
/// @param index The index number to check whether 1 or 0 is set.
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/core/utils/CallbackHandler.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

/// @title CallbackHandler
/// @author Aragon Association - 2022-2023
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/framework/dao/DAOFactory.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/framework/dao/DAORegistry.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {ProtocolVersion} from "../../utils/protocol/ProtocolVersion.sol";
import {IDAO} from "../../core/dao/IDAO.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

/// @title IPluginRepo
/// @author Aragon Association - 2022-2023
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {ProtocolVersion} from "../../../utils/protocol/ProtocolVersion.sol";
import {IDAO} from "../../../core/dao/IDAO.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {PermissionLib} from "../../../core/permission/PermissionLib.sol";
import {PluginRepo} from "../repo/PluginRepo.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {ERC165CheckerUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/framework/utils/RegistryUtils.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

/// @notice Validates that a subdomain name is composed only from characters in the allowed character set:
/// - the lowercase letters `a-z`
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/framework/utils/TokenFactory.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
// This is a migration file as suggested here https://docs.ens.domains/deploying-ens-on-a-private-chain#migration-file-example to compile the contracts and make their artifacts available in our tests.

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import "@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol";
import "@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
import "@ensdomains/ens-contracts/contracts/resolvers/Resolver.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {PluginUUPSUpgradeable} from "../../core/plugin/PluginUUPSUpgradeable.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {PluginUUPSUpgradeable} from "../../../core/plugin/PluginUUPSUpgradeable.sol";
import {MultiplyHelper} from "../MultiplyHelper.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {PluginUUPSUpgradeable} from "../../../core/plugin/PluginUUPSUpgradeable.sol";
import {MultiplyHelper} from "../MultiplyHelper.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/plugins/governance/admin/Admin.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {SafeCastUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {SafeCastUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {IDAO} from "../../../../core/dao/IDAO.sol";
import {DAO} from "../../../../core/dao/DAO.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {IVotesUpgradeable} from "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol";
import {SafeCastUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {IDAO} from "../../../core/dao/IDAO.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity 0.8.17;
pragma solidity ^0.8.8;

import {SafeCastUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";

Expand Down
Loading

0 comments on commit 4accb52

Please sign in to comment.