1
1
// SPDX-License-Identifier: MIT
2
2
// NatSpec format convention - https://docs.soliditylang.org/en/v0.5.10/natspec-format.html
3
- pragma solidity ^ 0.8.24 ;
3
+ pragma solidity ^ 0.8.26 ;
4
4
5
- import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol " ;
6
- import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol " ;
7
- import {NoncesUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol " ;
8
- import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol " ;
9
- import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol " ;
10
- import {Address} from "@openzeppelin/contracts/utils/Address.sol " ;
5
+ import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol " ;
6
+ import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol " ;
7
+ import { NoncesUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol " ;
8
+ import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol " ;
9
+ import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol " ;
10
+ import { Address } from "@openzeppelin/contracts/utils/Address.sol " ;
11
11
12
- import {GovernableUpgradeable} from "contracts/base/upgradeable/GovernableUpgradeable.sol " ;
13
- import {QuorumUpgradeable} from "contracts/base/upgradeable/QuorumUpgradeable.sol " ;
14
- import {IReferendum} from "contracts/interfaces/IReferendum.sol " ;
15
- import {IReferendumRoleManager} from "contracts/interfaces/IReferendumRoleManager.sol " ;
16
- import {IReferendumVerifiable} from "contracts/interfaces/IReferendumVerifiable.sol " ;
12
+ import { GovernableUpgradeable } from "contracts/base/upgradeable/GovernableUpgradeable.sol " ;
13
+ import { QuorumUpgradeable } from "contracts/base/upgradeable/QuorumUpgradeable.sol " ;
14
+ import { IReferendum } from "contracts/interfaces/IReferendum.sol " ;
15
+ import { IReferendumRoleManager } from "contracts/interfaces/IReferendumRoleManager.sol " ;
16
+ import { IReferendumVerifiable } from "contracts/interfaces/IReferendumVerifiable.sol " ;
17
17
18
- import {C } from "contracts/libraries/Constants.sol " ;
19
- import {T } from "contracts/libraries/Types.sol " ;
18
+ import { C } from "contracts/libraries/Constants.sol " ;
19
+ import { T } from "contracts/libraries/Types.sol " ;
20
20
21
21
/// @title Content curation contract.
22
22
/// @notice This contract allows for the submission, voting, and approval/rejection of content.
@@ -72,9 +72,7 @@ contract Referendum is
72
72
/// @notice Function that should revert when msg.sender is not authorized to upgrade the contract.
73
73
/// @param newImplementation The address of the new implementation contract.
74
74
/// @dev See https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable-_authorizeUpgrade-address-
75
- function _authorizeUpgrade (
76
- address newImplementation
77
- ) internal override onlyAdmin {}
75
+ function _authorizeUpgrade (address newImplementation ) internal override onlyAdmin {}
78
76
79
77
/// @notice Checks if the content is active nor blocked.
80
78
/// @param contentId The ID of the content.
@@ -87,10 +85,7 @@ contract Referendum is
87
85
/// @param initiator The submission account address .
88
86
/// @param contentId The ID of the content.
89
87
/// @return True if the content is approved, false otherwise.
90
- function isApproved (
91
- address initiator ,
92
- uint256 contentId
93
- ) public view returns (bool ) {
88
+ function isApproved (address initiator , uint256 contentId ) public view returns (bool ) {
94
89
bool approved = isActive (contentId);
95
90
bool validAccount = submissions[initiator].contains (contentId);
96
91
bool verifiedRole = hasRole (VERIFIED_ROLE, initiator);
@@ -128,21 +123,10 @@ contract Referendum is
128
123
/// @param contentId The ID of the content to be submitted.
129
124
/// @param initiator The address of the initiator submitting the content.
130
125
/// @param sig The EIP712 signature for the submission.
131
- function submitWithSig (
132
- uint256 contentId ,
133
- address initiator ,
134
- T.EIP712Signature calldata sig
135
- ) external {
126
+ function submitWithSig (uint256 contentId , address initiator , T.EIP712Signature calldata sig ) external {
136
127
// https://eips.ethereum.org/EIPS/eip-712
137
128
uint256 nonce = _useNonce (initiator);
138
- bytes32 structHash = keccak256 (
139
- abi.encode (
140
- C.REFERENDUM_SUBMIT_TYPEHASH,
141
- contentId,
142
- initiator,
143
- nonce
144
- )
145
- );
129
+ bytes32 structHash = keccak256 (abi.encode (C.REFERENDUM_SUBMIT_TYPEHASH, contentId, initiator, nonce));
146
130
147
131
// retrieve the signer from digest and signature to check if the signature correspond to expected signer.
148
132
bytes32 digest = _hashTypedDataV4 (structHash); // expected keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message))
0 commit comments