Skip to content

Commit

Permalink
Allow governor to receive ETH is executor == address(this)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Sep 13, 2021
1 parent 3c29f6b commit ae3311f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 7 additions & 0 deletions contracts/governance/Governor.sol
Expand Up @@ -55,6 +55,13 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
_name = name_;
}

/**
* @dev Function to receive ETH that will be handled by the governor (disabled if executor is a third party contract)
*/
receive() external payable virtual {
require(_executor() == address(this));
}

/**
* @dev See {IERC165-supportsInterface}.
*/
Expand Down
2 changes: 0 additions & 2 deletions contracts/mocks/GovernorCompMock.sol
Expand Up @@ -20,8 +20,6 @@ contract GovernorCompMock is Governor, GovernorVotesComp, GovernorCountingSimple
_votingPeriod = votingPeriod_;
}

receive() external payable {}

function votingDelay() public view override returns (uint256) {
return _votingDelay;
}
Expand Down
2 changes: 0 additions & 2 deletions contracts/mocks/GovernorMock.sol
Expand Up @@ -21,8 +21,6 @@ contract GovernorMock is Governor, GovernorVotesQuorumFraction, GovernorCounting
_votingPeriod = votingPeriod_;
}

receive() external payable {}

function votingDelay() public view override returns (uint256) {
return _votingDelay;
}
Expand Down

0 comments on commit ae3311f

Please sign in to comment.