Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(dopedao): add lifecycle integration tests #13

Merged
merged 5 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions contracts/governance/DopeDAO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ contract DopeDAO is Governor, GovernorCompatibilityBravo, GovernorVotesComp, Gov
GovernorTimelockCompound(_timelock)
{}

function votingDelay() public pure override returns (uint256) {
function votingDelay() public pure virtual override returns (uint256) {
return 13091; // 2 days (in blocks)
}

function votingPeriod() public pure override returns (uint256) {
function votingPeriod() public pure virtual override returns (uint256) {
return 45818; // 1 week (in blocks)
}

function quorum(uint256 blockNumber) public pure override returns (uint256) {
function quorum(uint256 blockNumber) public pure virtual override returns (uint256) {
return 500; // DOPE DAO NFT TOKENS
}

function proposalThreshold() public pure override returns (uint256) {
function proposalThreshold() public pure virtual override returns (uint256) {
return 50; // DOPE DAO NFT TOKENS
}

Expand Down Expand Up @@ -63,9 +63,14 @@ contract DopeDAO is Governor, GovernorCompatibilityBravo, GovernorVotesComp, Gov
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
bytes32 /*descriptionHash*/
) internal override(Governor, GovernorTimelockCompound) {
super._execute(proposalId, targets, values, calldatas, descriptionHash);
uint256 eta = proposalEta(proposalId);
require(eta > 0, "GovernorTimelockCompound: proposal not yet queued");
Address.sendValue(payable(timelock()), msg.value);
for (uint256 i = 0; i < targets.length; ++i) {
ICompoundTimelock(payable(timelock())).executeTransaction(targets[i], values[i], "", calldatas[i], eta);
}
}

function _cancel(
Expand All @@ -89,4 +94,11 @@ contract DopeDAO is Governor, GovernorCompatibilityBravo, GovernorVotesComp, Gov
{
return super.supportsInterface(interfaceId);
}

/**
* @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));
}
}
Loading