Skip to content

Commit

Permalink
Rename governor extension data extension to params
Browse files Browse the repository at this point in the history
  • Loading branch information
apbendi committed Jan 17, 2022
1 parent bcddb1e commit ae3119a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 34 deletions.
28 changes: 14 additions & 14 deletions contracts/governance/Governor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
// In addition to the current interfaceId, also support previous version of the interfaceId that did not
// include the castVoteWithData() and castVoteWithReasonAndData() functions as standard
// include the castVoteWithParams() and castVoteWithReasonAndParams() functions as standard
return
interfaceId ==
(type(IGovernor).interfaceId ^ this.castVoteWithReasonAndData.selector ^ this.castVoteWithData.selector) ||
(type(IGovernor).interfaceId ^ this.castVoteWithReasonAndParams.selector ^ this.castVoteWithParams.selector) ||
interfaceId == type(IGovernor).interfaceId ||
super.supportsInterface(interfaceId);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
address account,
uint8 support,
uint256 weight,
bytes memory data
bytes memory params
) internal virtual;

/**
Expand Down Expand Up @@ -314,15 +314,15 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
}

/**
* @dev See {IGovernor-castVoteWithData}.
* @dev See {IGovernor-castVoteWithParams}.
*/
function castVoteWithData(
function castVoteWithParams(
uint256 proposalId,
uint8 support,
bytes memory data
bytes memory params
) public virtual override returns (uint256) {
address voter = _msgSender();
return _castVote(proposalId, voter, support, "", data);
return _castVote(proposalId, voter, support, "", params);
}

/**
Expand All @@ -333,20 +333,20 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
uint8 support,
string calldata reason
) public virtual override returns (uint256) {
return castVoteWithReasonAndData(proposalId, support, reason, "");
return castVoteWithReasonAndParams(proposalId, support, reason, "");
}

/**
* @dev See {IGovernor-castVoteWithReasonAndData}.
* @dev See {IGovernor-castVoteWithReasonAndParams}.
*/
function castVoteWithReasonAndData(
function castVoteWithReasonAndParams(
uint256 proposalId,
uint8 support,
string calldata reason,
bytes memory data
bytes memory params
) public virtual override returns (uint256) {
address voter = _msgSender();
return _castVote(proposalId, voter, support, reason, data);
return _castVote(proposalId, voter, support, reason, params);
}

/**
Expand Down Expand Up @@ -379,13 +379,13 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
address account,
uint8 support,
string memory reason,
bytes memory data
bytes memory params
) internal virtual returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
require(state(proposalId) == ProposalState.Active, "Governor: vote not currently active");

uint256 weight = getVotes(account, proposal.voteStart.getDeadline());
_countVote(proposalId, account, support, weight, data);
_countVote(proposalId, account, support, weight, params);

emit VoteCast(account, proposalId, support, weight, reason);

Expand Down
12 changes: 6 additions & 6 deletions contracts/governance/IGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ abstract contract IGovernor is IERC165 {
function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);

/**
* @dev Cast a vote with contextual data
* @dev Cast a vote with additional encoded parameters
*
* Emits a {VoteCast} event.
*/
function castVoteWithData(
function castVoteWithParams(
uint256 proposalId,
uint8 support,
bytes memory data
bytes memory params
) public virtual returns (uint256 balance);

/**
Expand All @@ -215,15 +215,15 @@ abstract contract IGovernor is IERC165 {
) public virtual returns (uint256 balance);

/**
* @dev Cast a vote with a reason and contextual data
* @dev Cast a vote with a reason and additional encoded parameters
*
* Emits a {VoteCast} event.
*/
function castVoteWithReasonAndData(
function castVoteWithReasonAndParams(
uint256 proposalId,
uint8 support,
string calldata reason,
bytes memory data
bytes memory params
) public virtual returns (uint256 balance);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
address account,
uint8 support,
uint256 weight,
bytes memory data
bytes memory params
) internal virtual override {
(data); // silence compiler warnings
(params); // silence compiler warnings

ProposalDetails storage details = _proposalDetails[proposalId];
Receipt storage receipt = details.receipts[account];
Expand Down
4 changes: 2 additions & 2 deletions contracts/governance/extensions/GovernorCountingSimple.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ abstract contract GovernorCountingSimple is Governor {
address account,
uint8 support,
uint256 weight,
bytes memory data
bytes memory params
) internal virtual override {
(data); // silence compiler warnings
(params); // silence compiler warnings
ProposalVote storage proposalvote = _proposalVotes[proposalId];

require(!proposalvote.hasVoted[account], "GovernorVotingSimple: vote already cast");
Expand Down
4 changes: 2 additions & 2 deletions contracts/governance/extensions/GovernorPreventLateQuorum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ abstract contract GovernorPreventLateQuorum is Governor {
address account,
uint8 support,
string memory reason,
bytes memory data
bytes memory params
) internal virtual override returns (uint256) {
uint256 result = super._castVote(proposalId, account, support, reason, data);
uint256 result = super._castVote(proposalId, account, support, reason, params);

Timers.BlockNumber storage extendedDeadline = _extendedDeadlines[proposalId];

Expand Down
4 changes: 2 additions & 2 deletions contracts/mocks/GovernorPreventLateQuorumMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ contract GovernorPreventLateQuorumMock is
address account,
uint8 support,
string memory reason,
bytes memory data
bytes memory params
) internal virtual override(Governor, GovernorPreventLateQuorum) returns (uint256) {
return super._castVote(proposalId, account, support, reason, data);
return super._castVote(proposalId, account, support, reason, params);
}
}
2 changes: 1 addition & 1 deletion test/governance/Governor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract('Governor', function (accounts) {
shouldSupportInterfaces([
'ERC165',
'Governor',
'GovernorWithData',
'GovernorWithParams',
]);

it('deployment check', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract('GovernorTimelockCompound', function (accounts) {
shouldSupportInterfaces([
'ERC165',
'Governor',
'GovernorWithData',
'GovernorWithParams',
'GovernorTimelock',
]);

Expand Down
2 changes: 1 addition & 1 deletion test/governance/extensions/GovernorTimelockControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract('GovernorTimelockControl', function (accounts) {
shouldSupportInterfaces([
'ERC165',
'Governor',
'GovernorWithData',
'GovernorWithParams',
'GovernorTimelock',
]);

Expand Down
6 changes: 3 additions & 3 deletions test/utils/introspection/SupportsInterface.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const INTERFACES = {
'castVoteWithReason(uint256,uint8,string)',
'castVoteBySig(uint256,uint8,uint8,bytes32,bytes32)',
],
GovernorWithData: [
GovernorWithParams: [
'name()',
'version()',
'COUNTING_MODE()',
Expand All @@ -85,9 +85,9 @@ const INTERFACES = {
'propose(address[],uint256[],bytes[],string)',
'execute(address[],uint256[],bytes[],bytes32)',
'castVote(uint256,uint8)',
'castVoteWithData(uint256,uint8,bytes)',
'castVoteWithParams(uint256,uint8,bytes)',
'castVoteWithReason(uint256,uint8,string)',
'castVoteWithReasonAndData(uint256,uint8,string,bytes)',
'castVoteWithReasonAndParams(uint256,uint8,string,bytes)',
'castVoteBySig(uint256,uint8,uint8,bytes32,bytes32)',
],
GovernorTimelock: [
Expand Down

0 comments on commit ae3119a

Please sign in to comment.