-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create proposal id not enforced (#106)
* create proposal id not enforced * new changes
- Loading branch information
Showing
6 changed files
with
34 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,19 @@ import {IProposal} from "./IProposal.sol"; | |
/// @notice An abstract contract containing the traits and internal functionality to create and execute proposals that can be inherited by non-upgradeable DAO plugins. | ||
/// @custom:security-contact [email protected] | ||
abstract contract Proposal is IProposal, ERC165 { | ||
error FunctionDeprecated(); | ||
|
||
/// @inheritdoc IProposal | ||
function proposalCount() public pure override returns (uint256) { | ||
return type(uint256).max; | ||
function proposalCount() public view virtual override returns (uint256) { | ||
revert FunctionDeprecated(); | ||
} | ||
|
||
/// @notice Creates a proposal Id. | ||
/// @dev Uses block number and chain id to ensure more probability of uniqueness. | ||
/// @param salt The extra salt to help with uniqueness. | ||
/// @return The id of the proposal. | ||
function _createProposalId(bytes32 salt) internal view virtual returns (uint256) { | ||
return uint256(keccak256(abi.encode(block.chainid, block.number, address(this), salt))); | ||
} | ||
|
||
/// @notice Checks if this or the parent contract supports an interface by its ID. | ||
|
@@ -22,14 +32,13 @@ abstract contract Proposal is IProposal, ERC165 { | |
function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { | ||
// In addition to the current interfaceId, also support previous version of the interfaceId | ||
// that did not include the following functions: | ||
// `createProposal, canExecute, createProposalId, createProposalParamsABI`. | ||
// `createProposal, canExecute, customProposalParamsABI`. | ||
return | ||
_interfaceId == | ||
type(IProposal).interfaceId ^ | ||
IProposal.createProposal.selector ^ | ||
IProposal.canExecute.selector ^ | ||
IProposal.createProposalId.selector ^ | ||
IProposal.createProposalParamsABI.selector || | ||
IProposal.customProposalParamsABI.selector || | ||
_interfaceId == type(IProposal).interfaceId || | ||
super.supportsInterface(_interfaceId); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters