1
+ pragma solidity ^ 0.8.4 ;
2
+
1
3
import "./STANG.sol " ;
4
+ import "@openzeppelin/contracts/governance/Governor.sol " ;
5
+ import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol " ;
6
+ import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol " ;
7
+ import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol " ;
8
+ import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol " ;
9
+
10
+ contract DAO is
11
+ Governor ,
12
+ GovernorCountingSimple ,
13
+ GovernorVotes ,
14
+ GovernorVotesQuorumFraction ,
15
+ GovernorTimelockControl
16
+ {
17
+ uint256 public s_votingDelay;
18
+ uint256 public s_votingPeriod;
19
+ STANG daoToken;
2
20
3
- pragma solidity ^ 0.8.4 ;
21
+ constructor (
22
+ address _daoToken
23
+ ERC20Votes _token ,
24
+ TimelockController _timelock ,
25
+ uint256 _quorumPercentage ,
26
+ uint256 _votingPeriod ,
27
+ uint256 _votingDelay
28
+ )
29
+ Governor ("GovernorContract " )
30
+ GovernorVotes (_token)
31
+ GovernorVotesQuorumFraction (_quorumPercentage)
32
+ GovernorTimelockControl (_timelock)
33
+ {
34
+ daoToken = STANG (_daoToken);
35
+ s_votingDelay = _votingDelay;
36
+ s_votingPeriod = _votingPeriod;
37
+ }
4
38
5
- contract DAO {
6
39
struct Proposal {
7
40
uint256 [] opts;
8
41
bool weighted;
@@ -16,17 +49,11 @@ contract DAO {
16
49
uint256 totalVotes;
17
50
}
18
51
19
- STANG daoToken;
20
-
21
52
//proposalId => Proposal
22
53
mapping (uint256 => Proposal) public proposals;
23
54
24
55
uint256 propsIdCnt = 0 ;
25
56
26
- constructor (address _daoToken ) {
27
- daoToken = STANG (_daoToken);
28
- }
29
-
30
57
//optsString[], title, description, propId, endTimestamp
31
58
event newProposal (string [], string , string , uint256 , uint256 );
32
59
0 commit comments