Skip to content

Commit

Permalink
add governance dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
eukadish committed Sep 5, 2024
1 parent d78fa15 commit 1a2c198
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/governance/DAM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessContr
import {SafeCast} from "openzeppelin-contracts/contracts/utils/math/SafeCast.sol";
import {ERC20Votes, ERC20, ERC20Permit} from "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Votes.sol";

import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import {Context} from "openzeppelin-contracts/contracts/utils/Context.sol";

// burnable, mintable

contract DAM is ERC20Votes {
uint256 private constant supply = 1_000_000_000e18;

constructor() ERC20("DAM", "DAM") {
constructor(/* admin */) ERC20("DAM", "DAM") ERC20Permit("DAM") {
_mint(msg.sender, supply);
}

// mint - - owner

// burn - -

// function clock() public view virtual override returns (uint48) {
// return SafeCast.toUint48(block.timestamp);
// }
Expand Down
93 changes: 93 additions & 0 deletions src/governance/Governor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {IERC165} from "openzeppelin-contracts/contracts/interfaces/IERC165.sol";

import {IVotes} from "openzeppelin-contracts/contracts/governance/utils/IVotes.sol";

import {TimelockController} from "openzeppelin-contracts/contracts/governance/TimelockController.sol";

import {IGovernor} from "openzeppelin-contracts/contracts/governance/IGovernor.sol";

import {Governor} from "openzeppelin-contracts/contracts/governance/Governor.sol";
import {GovernorVotes} from "openzeppelin-contracts/contracts/governance/extensions/GovernorVotes.sol";
import {GovernorTimelockControl} from "openzeppelin-contracts/contracts/governance/extensions/GovernorTimelockControl.sol";

contract ReservoirGovernor is GovernorVotes, GovernorTimelockControl {
constructor(
string memory name_,
IVotes token_,
TimelockController timelock_
)
GovernorVotes(token_)
GovernorTimelockControl(timelock_)
Governor(name_)
{}

// function quorum(uint256) public pure override returns (uint256) {
// return 0;
// }

// function votingDelay() public pure override returns (uint256) {
// return 4;
// }

// function votingPeriod() public pure override returns (uint256) {
// return 16;
// }

// function cancel(
// address[] memory targets,
// uint256[] memory values,
// bytes[] memory calldatas,
// bytes32 salt
// ) public returns (uint256 proposalId) {
// return _cancel(targets, values, calldatas, salt);
// }

function state(
uint256 proposalId
)
public
view
override(Governor, GovernorTimelockControl)
returns (ProposalState)
{
return super.state(proposalId);
}

function _execute(
uint256 proposalId,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal override(Governor, GovernorTimelockControl) {
super._execute(proposalId, targets, values, calldatas, descriptionHash);
}

function _cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal override(Governor, GovernorTimelockControl) returns (uint256) {
return super._cancel(targets, values, calldatas, descriptionHash);
}

function _executor()
internal
view
override(Governor, GovernorTimelockControl)
returns (address)
{
return super._executor();
}

function supportsInterface(
bytes4 interfaceId
) public view override(Governor, GovernorTimelockControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
}

0 comments on commit 1a2c198

Please sign in to comment.