From 6f1609bb00d236abda1c1893a218778fa585b8af Mon Sep 17 00:00:00 2001 From: "yonatan.tesfu" <yonatan.tesfu@etu.hesge.ch> Date: Sun, 27 Nov 2022 20:21:46 +0100 Subject: [PATCH] fichier governor --- MyGovernor.sol | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 MyGovernor.sol diff --git a/MyGovernor.sol b/MyGovernor.sol new file mode 100644 index 00000000..9afdf760 --- /dev/null +++ b/MyGovernor.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.7; + +import "@openzeppelin/contracts/governance/Governor.sol"; +import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol"; +import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol"; +import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol"; + +contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction { + constructor(IVotes _token) + Governor("MyGovernor") + GovernorVotes(_token) + GovernorVotesQuorumFraction(1) + {} + + function votingDelay() public pure override returns (uint256) { + return 0; // 0 block + } + + function votingPeriod() public pure override returns (uint256) { + return 1; // 1 blocks + } + + // The following functions are overrides required by Solidity. + + function quorum(uint256 blockNumber) + public + view + override(IGovernor, GovernorVotesQuorumFraction) + returns (uint256) + { + return super.quorum(blockNumber); + } +} -- GitLab