Skip to content

Commit

Permalink
add hasSucceeded instead of (#112)
Browse files Browse the repository at this point in the history
* add hasSucceeded instead of

* remove .only
  • Loading branch information
novaknole authored Nov 4, 2024
1 parent d4cfd50 commit 461a75d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Use [OpenZepplin v4.9.6](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v4.9.6).
- Updated hardhat configuration to use the `commons- config` networks.
- Updated hardhat configuration to use the `commons-config` networks.

## v1.4.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract ProposalMock is Proposal {
bytes memory
) external returns (uint256 proposalId) {}

function canExecute(uint256 proposalId) external view returns (bool) {}
function hasSucceeded(uint256 proposalId) external view returns (bool) {}

function customProposalParamsABI() external view returns (string memory) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract ProposalUpgradeableMock is ProposalUpgradeable {
bytes memory
) external returns (uint256 proposalId) {}

function canExecute(uint256 proposalId) external view returns (bool) {}
function hasSucceeded(uint256 proposalId) external view returns (bool) {}

function customProposalParamsABI() external view returns (string memory) {}
}
7 changes: 4 additions & 3 deletions contracts/src/plugin/extensions/proposal/IProposal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ interface IProposal {
bytes memory data
) external returns (uint256 proposalId);

/// @notice Whether proposal can be executed or not.
/// @notice Whether proposal succeeded or not.
/// @dev Note that this must not include time window checks and only make a decision based on the thresholds.
/// @param proposalId The id of the proposal.
/// @return bool Returns if proposal can be executed or not.
function canExecute(uint256 proposalId) external view returns (bool);
/// @return bool Returns if proposal has been succeeded or not without including time window checks.
function hasSucceeded(uint256 proposalId) external view returns (bool);

/// @notice The human-readable abi format for extra params included in `data` of `createProposal`.
/// @dev Used for UI to easily detect what extra params the contract expects.
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/plugin/extensions/proposal/Proposal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ 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, customProposalParamsABI`.
// `createProposal`, `hasSucceeded`, `customProposalParamsABI`.
return
_interfaceId ==
type(IProposal).interfaceId ^
IProposal.createProposal.selector ^
IProposal.canExecute.selector ^
IProposal.hasSucceeded.selector ^
IProposal.customProposalParamsABI.selector ||
_interfaceId == type(IProposal).interfaceId ||
super.supportsInterface(_interfaceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ abstract contract ProposalUpgradeable is IProposal, ERC165Upgradeable {
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, customProposalParamsABI`.
// `createProposal`, `hasSucceeded`, `customProposalParamsABI`.
return
_interfaceId ==
type(IProposal).interfaceId ^
IProposal.createProposal.selector ^
IProposal.canExecute.selector ^
IProposal.hasSucceeded.selector ^
IProposal.customProposalParamsABI.selector ||
_interfaceId == type(IProposal).interfaceId ||
super.supportsInterface(_interfaceId);
Expand Down

0 comments on commit 461a75d

Please sign in to comment.