@openzeppelin/wizard 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +2 -0
- package/dist/api.d.ts +5 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/build-generic.d.ts +1 -1
- package/dist/build-generic.d.ts.map +1 -1
- package/dist/contract.d.ts +3 -3
- package/dist/contract.d.ts.map +1 -1
- package/dist/environments/hardhat/package-lock.json +15204 -0
- package/dist/environments/hardhat/package.json +34 -0
- package/dist/environments/hardhat/upgradeable/package-lock.json +15588 -0
- package/dist/environments/hardhat/upgradeable/package.json +35 -0
- package/dist/erc1155.js +1 -1
- package/dist/erc1155.js.map +1 -1
- package/dist/erc721.js +2 -0
- package/dist/erc721.js.map +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/generate/alternatives.d.ts +2 -2
- package/dist/generate/alternatives.d.ts.map +1 -1
- package/dist/generate/sources.d.ts +1 -1
- package/dist/generate/sources.d.ts.map +1 -1
- package/dist/governor.d.ts +2 -2
- package/dist/governor.d.ts.map +1 -1
- package/dist/governor.js +1 -1
- package/dist/governor.js.map +1 -1
- package/dist/kind.d.ts +1 -1
- package/dist/kind.d.ts.map +1 -1
- package/dist/print-versioned.js +5 -2
- package/dist/print-versioned.js.map +1 -1
- package/dist/print.d.ts.map +1 -1
- package/dist/print.js +5 -2
- package/dist/print.js.map +1 -1
- package/dist/set-access-control.d.ts +1 -1
- package/dist/set-access-control.d.ts.map +1 -1
- package/dist/set-info.d.ts +1 -1
- package/dist/set-info.d.ts.map +1 -1
- package/dist/set-upgradeable.d.ts +1 -1
- package/dist/set-upgradeable.d.ts.map +1 -1
- package/dist/solidity-version.json +1 -0
- package/dist/utils/define-functions.d.ts +1 -1
- package/dist/utils/define-functions.d.ts.map +1 -1
- package/dist/utils/format-lines.d.ts +2 -1
- package/dist/utils/format-lines.d.ts.map +1 -1
- package/dist/utils/format-lines.js +9 -5
- package/dist/utils/format-lines.js.map +1 -1
- package/dist/utils/transitive-closure.d.ts +1 -1
- package/dist/utils/transitive-closure.d.ts.map +1 -1
- package/dist/zip-hardhat.d.ts +5 -0
- package/dist/zip-hardhat.d.ts.map +1 -0
- package/dist/zip-hardhat.js +187 -0
- package/dist/zip-hardhat.js.map +1 -0
- package/dist/zip.js +1 -1
- package/dist/zip.js.map +1 -1
- package/package.json +9 -7
- package/src/.DS_Store +0 -0
- package/src/environments/.DS_Store +0 -0
- package/src/environments/hardhat/.DS_Store +0 -0
- package/src/environments/hardhat/package-lock.json +15204 -0
- package/src/environments/hardhat/package.json +34 -0
- package/src/environments/hardhat/upgradeable/package-lock.json +15588 -0
- package/src/environments/hardhat/upgradeable/package.json +35 -0
- package/src/erc1155.ts +1 -1
- package/src/erc721.ts +2 -0
- package/src/governor.ts +1 -1
- package/src/print-versioned.ts +2 -2
- package/src/print.ts +1 -2
- package/src/solidity-version.json +1 -0
- package/src/utils/format-lines.ts +8 -3
- package/src/zip-hardhat.ts +186 -0
- package/src/zip.ts +1 -1
- package/dist/contract.test.d.ts +0 -2
- package/dist/contract.test.d.ts.map +0 -1
- package/dist/contract.test.js +0 -147
- package/dist/contract.test.js.map +0 -1
- package/dist/custom.test.d.ts +0 -2
- package/dist/custom.test.d.ts.map +0 -1
- package/dist/custom.test.js +0 -70
- package/dist/custom.test.js.map +0 -1
- package/dist/erc1155.test.d.ts +0 -2
- package/dist/erc1155.test.d.ts.map +0 -1
- package/dist/erc1155.test.js +0 -91
- package/dist/erc1155.test.js.map +0 -1
- package/dist/erc20.test.d.ts +0 -2
- package/dist/erc20.test.d.ts.map +0 -1
- package/dist/erc20.test.js +0 -133
- package/dist/erc20.test.js.map +0 -1
- package/dist/erc721.test.d.ts +0 -2
- package/dist/erc721.test.d.ts.map +0 -1
- package/dist/erc721.test.js +0 -112
- package/dist/erc721.test.js.map +0 -1
- package/dist/governor.test.d.ts +0 -2
- package/dist/governor.test.d.ts.map +0 -1
- package/dist/governor.test.js +0 -108
- package/dist/governor.test.js.map +0 -1
- package/dist/utils/to-identifier.test.d.ts +0 -2
- package/dist/utils/to-identifier.test.d.ts.map +0 -1
- package/dist/utils/to-identifier.test.js +0 -21
- package/dist/utils/to-identifier.test.js.map +0 -1
- package/dist/zip.test.d.ts +0 -2
- package/dist/zip.test.d.ts.map +0 -1
- package/dist/zip.test.js +0 -37
- package/dist/zip.test.js.map +0 -1
- package/src/contract.test.ts +0 -164
- package/src/contract.test.ts.md +0 -272
- package/src/contract.test.ts.snap +0 -0
- package/src/custom.test.ts +0 -80
- package/src/custom.test.ts.md +0 -154
- package/src/custom.test.ts.snap +0 -0
- package/src/erc1155.test.ts +0 -103
- package/src/erc1155.test.ts.md +0 -432
- package/src/erc1155.test.ts.snap +0 -0
- package/src/erc20.test.ts +0 -152
- package/src/erc20.test.ts.md +0 -571
- package/src/erc20.test.ts.snap +0 -0
- package/src/erc721.test.ts +0 -129
- package/src/erc721.test.ts.md +0 -517
- package/src/erc721.test.ts.snap +0 -0
- package/src/governor.test.ts +0 -125
- package/src/governor.test.ts.md +0 -1419
- package/src/governor.test.ts.snap +0 -0
- package/src/utils/to-identifier.test.ts +0 -20
- package/src/zip.test.ts +0 -35
package/src/governor.test.ts.md
DELETED
|
@@ -1,1419 +0,0 @@
|
|
|
1
|
-
# Snapshot report for `src/governor.test.ts`
|
|
2
|
-
|
|
3
|
-
The actual snapshot is saved in `governor.test.ts.snap`.
|
|
4
|
-
|
|
5
|
-
Generated by [AVA](https://avajs.dev).
|
|
6
|
-
|
|
7
|
-
## governor with proposal threshold
|
|
8
|
-
|
|
9
|
-
> Snapshot 1
|
|
10
|
-
|
|
11
|
-
`// SPDX-License-Identifier: MIT␊
|
|
12
|
-
pragma solidity ^0.8.4;␊
|
|
13
|
-
␊
|
|
14
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
15
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
16
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
17
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
18
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
19
|
-
␊
|
|
20
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
21
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
22
|
-
Governor("MyGovernor")␊
|
|
23
|
-
GovernorVotes(_token)␊
|
|
24
|
-
GovernorVotesQuorumFraction(4)␊
|
|
25
|
-
GovernorTimelockControl(_timelock)␊
|
|
26
|
-
{}␊
|
|
27
|
-
␊
|
|
28
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
29
|
-
return 45818; // 1 week␊
|
|
30
|
-
}␊
|
|
31
|
-
␊
|
|
32
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
33
|
-
return 45818; // 1 week␊
|
|
34
|
-
}␊
|
|
35
|
-
␊
|
|
36
|
-
function proposalThreshold() public pure override returns (uint256) {␊
|
|
37
|
-
return 1e18;␊
|
|
38
|
-
}␊
|
|
39
|
-
␊
|
|
40
|
-
// The following functions are overrides required by Solidity.␊
|
|
41
|
-
␊
|
|
42
|
-
function quorum(uint256 blockNumber)␊
|
|
43
|
-
public␊
|
|
44
|
-
view␊
|
|
45
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
46
|
-
returns (uint256)␊
|
|
47
|
-
{␊
|
|
48
|
-
return super.quorum(blockNumber);␊
|
|
49
|
-
}␊
|
|
50
|
-
␊
|
|
51
|
-
function state(uint256 proposalId)␊
|
|
52
|
-
public␊
|
|
53
|
-
view␊
|
|
54
|
-
override(Governor, GovernorTimelockControl)␊
|
|
55
|
-
returns (ProposalState)␊
|
|
56
|
-
{␊
|
|
57
|
-
return super.state(proposalId);␊
|
|
58
|
-
}␊
|
|
59
|
-
␊
|
|
60
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
61
|
-
public␊
|
|
62
|
-
override(Governor, IGovernor)␊
|
|
63
|
-
returns (uint256)␊
|
|
64
|
-
{␊
|
|
65
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
66
|
-
}␊
|
|
67
|
-
␊
|
|
68
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
69
|
-
internal␊
|
|
70
|
-
override(Governor, GovernorTimelockControl)␊
|
|
71
|
-
{␊
|
|
72
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
73
|
-
}␊
|
|
74
|
-
␊
|
|
75
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
76
|
-
internal␊
|
|
77
|
-
override(Governor, GovernorTimelockControl)␊
|
|
78
|
-
returns (uint256)␊
|
|
79
|
-
{␊
|
|
80
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
81
|
-
}␊
|
|
82
|
-
␊
|
|
83
|
-
function _executor()␊
|
|
84
|
-
internal␊
|
|
85
|
-
view␊
|
|
86
|
-
override(Governor, GovernorTimelockControl)␊
|
|
87
|
-
returns (address)␊
|
|
88
|
-
{␊
|
|
89
|
-
return super._executor();␊
|
|
90
|
-
}␊
|
|
91
|
-
␊
|
|
92
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
93
|
-
public␊
|
|
94
|
-
view␊
|
|
95
|
-
override(Governor, GovernorTimelockControl)␊
|
|
96
|
-
returns (bool)␊
|
|
97
|
-
{␊
|
|
98
|
-
return super.supportsInterface(interfaceId);␊
|
|
99
|
-
}␊
|
|
100
|
-
}␊
|
|
101
|
-
`
|
|
102
|
-
|
|
103
|
-
## governor with custom block time
|
|
104
|
-
|
|
105
|
-
> Snapshot 1
|
|
106
|
-
|
|
107
|
-
`// SPDX-License-Identifier: MIT␊
|
|
108
|
-
pragma solidity ^0.8.4;␊
|
|
109
|
-
␊
|
|
110
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
111
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
112
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
113
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
114
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
115
|
-
␊
|
|
116
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
117
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
118
|
-
Governor("MyGovernor")␊
|
|
119
|
-
GovernorVotes(_token)␊
|
|
120
|
-
GovernorVotesQuorumFraction(4)␊
|
|
121
|
-
GovernorTimelockControl(_timelock)␊
|
|
122
|
-
{}␊
|
|
123
|
-
␊
|
|
124
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
125
|
-
return 100800; // 1 week␊
|
|
126
|
-
}␊
|
|
127
|
-
␊
|
|
128
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
129
|
-
return 100800; // 1 week␊
|
|
130
|
-
}␊
|
|
131
|
-
␊
|
|
132
|
-
// The following functions are overrides required by Solidity.␊
|
|
133
|
-
␊
|
|
134
|
-
function quorum(uint256 blockNumber)␊
|
|
135
|
-
public␊
|
|
136
|
-
view␊
|
|
137
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
138
|
-
returns (uint256)␊
|
|
139
|
-
{␊
|
|
140
|
-
return super.quorum(blockNumber);␊
|
|
141
|
-
}␊
|
|
142
|
-
␊
|
|
143
|
-
function state(uint256 proposalId)␊
|
|
144
|
-
public␊
|
|
145
|
-
view␊
|
|
146
|
-
override(Governor, GovernorTimelockControl)␊
|
|
147
|
-
returns (ProposalState)␊
|
|
148
|
-
{␊
|
|
149
|
-
return super.state(proposalId);␊
|
|
150
|
-
}␊
|
|
151
|
-
␊
|
|
152
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
153
|
-
public␊
|
|
154
|
-
override(Governor, IGovernor)␊
|
|
155
|
-
returns (uint256)␊
|
|
156
|
-
{␊
|
|
157
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
158
|
-
}␊
|
|
159
|
-
␊
|
|
160
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
161
|
-
internal␊
|
|
162
|
-
override(Governor, GovernorTimelockControl)␊
|
|
163
|
-
{␊
|
|
164
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
165
|
-
}␊
|
|
166
|
-
␊
|
|
167
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
168
|
-
internal␊
|
|
169
|
-
override(Governor, GovernorTimelockControl)␊
|
|
170
|
-
returns (uint256)␊
|
|
171
|
-
{␊
|
|
172
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
173
|
-
}␊
|
|
174
|
-
␊
|
|
175
|
-
function _executor()␊
|
|
176
|
-
internal␊
|
|
177
|
-
view␊
|
|
178
|
-
override(Governor, GovernorTimelockControl)␊
|
|
179
|
-
returns (address)␊
|
|
180
|
-
{␊
|
|
181
|
-
return super._executor();␊
|
|
182
|
-
}␊
|
|
183
|
-
␊
|
|
184
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
185
|
-
public␊
|
|
186
|
-
view␊
|
|
187
|
-
override(Governor, GovernorTimelockControl)␊
|
|
188
|
-
returns (bool)␊
|
|
189
|
-
{␊
|
|
190
|
-
return super.supportsInterface(interfaceId);␊
|
|
191
|
-
}␊
|
|
192
|
-
}␊
|
|
193
|
-
`
|
|
194
|
-
|
|
195
|
-
## governor with custom decimals
|
|
196
|
-
|
|
197
|
-
> Snapshot 1
|
|
198
|
-
|
|
199
|
-
`// SPDX-License-Identifier: MIT␊
|
|
200
|
-
pragma solidity ^0.8.4;␊
|
|
201
|
-
␊
|
|
202
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
203
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
204
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
205
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
206
|
-
␊
|
|
207
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorTimelockControl {␊
|
|
208
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
209
|
-
Governor("MyGovernor")␊
|
|
210
|
-
GovernorVotes(_token)␊
|
|
211
|
-
GovernorTimelockControl(_timelock)␊
|
|
212
|
-
{}␊
|
|
213
|
-
␊
|
|
214
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
215
|
-
return 45818; // 1 week␊
|
|
216
|
-
}␊
|
|
217
|
-
␊
|
|
218
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
219
|
-
return 45818; // 1 week␊
|
|
220
|
-
}␊
|
|
221
|
-
␊
|
|
222
|
-
function quorum(uint256 blockNumber) public pure override returns (uint256) {␊
|
|
223
|
-
return 1e6;␊
|
|
224
|
-
}␊
|
|
225
|
-
␊
|
|
226
|
-
function proposalThreshold() public pure override returns (uint256) {␊
|
|
227
|
-
return 1e6;␊
|
|
228
|
-
}␊
|
|
229
|
-
␊
|
|
230
|
-
// The following functions are overrides required by Solidity.␊
|
|
231
|
-
␊
|
|
232
|
-
function state(uint256 proposalId)␊
|
|
233
|
-
public␊
|
|
234
|
-
view␊
|
|
235
|
-
override(Governor, GovernorTimelockControl)␊
|
|
236
|
-
returns (ProposalState)␊
|
|
237
|
-
{␊
|
|
238
|
-
return super.state(proposalId);␊
|
|
239
|
-
}␊
|
|
240
|
-
␊
|
|
241
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
242
|
-
public␊
|
|
243
|
-
override(Governor, IGovernor)␊
|
|
244
|
-
returns (uint256)␊
|
|
245
|
-
{␊
|
|
246
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
247
|
-
}␊
|
|
248
|
-
␊
|
|
249
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
250
|
-
internal␊
|
|
251
|
-
override(Governor, GovernorTimelockControl)␊
|
|
252
|
-
{␊
|
|
253
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
254
|
-
}␊
|
|
255
|
-
␊
|
|
256
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
257
|
-
internal␊
|
|
258
|
-
override(Governor, GovernorTimelockControl)␊
|
|
259
|
-
returns (uint256)␊
|
|
260
|
-
{␊
|
|
261
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
262
|
-
}␊
|
|
263
|
-
␊
|
|
264
|
-
function _executor()␊
|
|
265
|
-
internal␊
|
|
266
|
-
view␊
|
|
267
|
-
override(Governor, GovernorTimelockControl)␊
|
|
268
|
-
returns (address)␊
|
|
269
|
-
{␊
|
|
270
|
-
return super._executor();␊
|
|
271
|
-
}␊
|
|
272
|
-
␊
|
|
273
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
274
|
-
public␊
|
|
275
|
-
view␊
|
|
276
|
-
override(Governor, GovernorTimelockControl)␊
|
|
277
|
-
returns (bool)␊
|
|
278
|
-
{␊
|
|
279
|
-
return super.supportsInterface(interfaceId);␊
|
|
280
|
-
}␊
|
|
281
|
-
}␊
|
|
282
|
-
`
|
|
283
|
-
|
|
284
|
-
## governor with 0 decimals
|
|
285
|
-
|
|
286
|
-
> Snapshot 1
|
|
287
|
-
|
|
288
|
-
`// SPDX-License-Identifier: MIT␊
|
|
289
|
-
pragma solidity ^0.8.4;␊
|
|
290
|
-
␊
|
|
291
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
292
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
293
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
294
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
295
|
-
␊
|
|
296
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorTimelockControl {␊
|
|
297
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
298
|
-
Governor("MyGovernor")␊
|
|
299
|
-
GovernorVotes(_token)␊
|
|
300
|
-
GovernorTimelockControl(_timelock)␊
|
|
301
|
-
{}␊
|
|
302
|
-
␊
|
|
303
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
304
|
-
return 45818; // 1 week␊
|
|
305
|
-
}␊
|
|
306
|
-
␊
|
|
307
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
308
|
-
return 45818; // 1 week␊
|
|
309
|
-
}␊
|
|
310
|
-
␊
|
|
311
|
-
function quorum(uint256 blockNumber) public pure override returns (uint256) {␊
|
|
312
|
-
return 1;␊
|
|
313
|
-
}␊
|
|
314
|
-
␊
|
|
315
|
-
function proposalThreshold() public pure override returns (uint256) {␊
|
|
316
|
-
return 1;␊
|
|
317
|
-
}␊
|
|
318
|
-
␊
|
|
319
|
-
// The following functions are overrides required by Solidity.␊
|
|
320
|
-
␊
|
|
321
|
-
function state(uint256 proposalId)␊
|
|
322
|
-
public␊
|
|
323
|
-
view␊
|
|
324
|
-
override(Governor, GovernorTimelockControl)␊
|
|
325
|
-
returns (ProposalState)␊
|
|
326
|
-
{␊
|
|
327
|
-
return super.state(proposalId);␊
|
|
328
|
-
}␊
|
|
329
|
-
␊
|
|
330
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
331
|
-
public␊
|
|
332
|
-
override(Governor, IGovernor)␊
|
|
333
|
-
returns (uint256)␊
|
|
334
|
-
{␊
|
|
335
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
336
|
-
}␊
|
|
337
|
-
␊
|
|
338
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
339
|
-
internal␊
|
|
340
|
-
override(Governor, GovernorTimelockControl)␊
|
|
341
|
-
{␊
|
|
342
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
343
|
-
}␊
|
|
344
|
-
␊
|
|
345
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
346
|
-
internal␊
|
|
347
|
-
override(Governor, GovernorTimelockControl)␊
|
|
348
|
-
returns (uint256)␊
|
|
349
|
-
{␊
|
|
350
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
351
|
-
}␊
|
|
352
|
-
␊
|
|
353
|
-
function _executor()␊
|
|
354
|
-
internal␊
|
|
355
|
-
view␊
|
|
356
|
-
override(Governor, GovernorTimelockControl)␊
|
|
357
|
-
returns (address)␊
|
|
358
|
-
{␊
|
|
359
|
-
return super._executor();␊
|
|
360
|
-
}␊
|
|
361
|
-
␊
|
|
362
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
363
|
-
public␊
|
|
364
|
-
view␊
|
|
365
|
-
override(Governor, GovernorTimelockControl)␊
|
|
366
|
-
returns (bool)␊
|
|
367
|
-
{␊
|
|
368
|
-
return super.supportsInterface(interfaceId);␊
|
|
369
|
-
}␊
|
|
370
|
-
}␊
|
|
371
|
-
`
|
|
372
|
-
|
|
373
|
-
## governor with settings
|
|
374
|
-
|
|
375
|
-
> Snapshot 1
|
|
376
|
-
|
|
377
|
-
`// SPDX-License-Identifier: MIT␊
|
|
378
|
-
pragma solidity ^0.8.4;␊
|
|
379
|
-
␊
|
|
380
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
381
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";␊
|
|
382
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
383
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
384
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
385
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
386
|
-
␊
|
|
387
|
-
contract MyGovernor is Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
388
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
389
|
-
Governor("MyGovernor")␊
|
|
390
|
-
GovernorSettings(45818 /* 1 week */, 45818 /* 1 week */, 1e18)␊
|
|
391
|
-
GovernorVotes(_token)␊
|
|
392
|
-
GovernorVotesQuorumFraction(4)␊
|
|
393
|
-
GovernorTimelockControl(_timelock)␊
|
|
394
|
-
{}␊
|
|
395
|
-
␊
|
|
396
|
-
// The following functions are overrides required by Solidity.␊
|
|
397
|
-
␊
|
|
398
|
-
function votingDelay()␊
|
|
399
|
-
public␊
|
|
400
|
-
view␊
|
|
401
|
-
override(IGovernor, GovernorSettings)␊
|
|
402
|
-
returns (uint256)␊
|
|
403
|
-
{␊
|
|
404
|
-
return super.votingDelay();␊
|
|
405
|
-
}␊
|
|
406
|
-
␊
|
|
407
|
-
function votingPeriod()␊
|
|
408
|
-
public␊
|
|
409
|
-
view␊
|
|
410
|
-
override(IGovernor, GovernorSettings)␊
|
|
411
|
-
returns (uint256)␊
|
|
412
|
-
{␊
|
|
413
|
-
return super.votingPeriod();␊
|
|
414
|
-
}␊
|
|
415
|
-
␊
|
|
416
|
-
function quorum(uint256 blockNumber)␊
|
|
417
|
-
public␊
|
|
418
|
-
view␊
|
|
419
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
420
|
-
returns (uint256)␊
|
|
421
|
-
{␊
|
|
422
|
-
return super.quorum(blockNumber);␊
|
|
423
|
-
}␊
|
|
424
|
-
␊
|
|
425
|
-
function state(uint256 proposalId)␊
|
|
426
|
-
public␊
|
|
427
|
-
view␊
|
|
428
|
-
override(Governor, GovernorTimelockControl)␊
|
|
429
|
-
returns (ProposalState)␊
|
|
430
|
-
{␊
|
|
431
|
-
return super.state(proposalId);␊
|
|
432
|
-
}␊
|
|
433
|
-
␊
|
|
434
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
435
|
-
public␊
|
|
436
|
-
override(Governor, IGovernor)␊
|
|
437
|
-
returns (uint256)␊
|
|
438
|
-
{␊
|
|
439
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
440
|
-
}␊
|
|
441
|
-
␊
|
|
442
|
-
function proposalThreshold()␊
|
|
443
|
-
public␊
|
|
444
|
-
view␊
|
|
445
|
-
override(Governor, GovernorSettings)␊
|
|
446
|
-
returns (uint256)␊
|
|
447
|
-
{␊
|
|
448
|
-
return super.proposalThreshold();␊
|
|
449
|
-
}␊
|
|
450
|
-
␊
|
|
451
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
452
|
-
internal␊
|
|
453
|
-
override(Governor, GovernorTimelockControl)␊
|
|
454
|
-
{␊
|
|
455
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
456
|
-
}␊
|
|
457
|
-
␊
|
|
458
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
459
|
-
internal␊
|
|
460
|
-
override(Governor, GovernorTimelockControl)␊
|
|
461
|
-
returns (uint256)␊
|
|
462
|
-
{␊
|
|
463
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
464
|
-
}␊
|
|
465
|
-
␊
|
|
466
|
-
function _executor()␊
|
|
467
|
-
internal␊
|
|
468
|
-
view␊
|
|
469
|
-
override(Governor, GovernorTimelockControl)␊
|
|
470
|
-
returns (address)␊
|
|
471
|
-
{␊
|
|
472
|
-
return super._executor();␊
|
|
473
|
-
}␊
|
|
474
|
-
␊
|
|
475
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
476
|
-
public␊
|
|
477
|
-
view␊
|
|
478
|
-
override(Governor, GovernorTimelockControl)␊
|
|
479
|
-
returns (bool)␊
|
|
480
|
-
{␊
|
|
481
|
-
return super.supportsInterface(interfaceId);␊
|
|
482
|
-
}␊
|
|
483
|
-
}␊
|
|
484
|
-
`
|
|
485
|
-
|
|
486
|
-
## governor with bravo
|
|
487
|
-
|
|
488
|
-
> Snapshot 1
|
|
489
|
-
|
|
490
|
-
`// SPDX-License-Identifier: MIT␊
|
|
491
|
-
pragma solidity ^0.8.4;␊
|
|
492
|
-
␊
|
|
493
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
494
|
-
import "@openzeppelin/contracts/governance/compatibility/GovernorCompatibilityBravo.sol";␊
|
|
495
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
496
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
497
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
498
|
-
␊
|
|
499
|
-
contract MyGovernor is Governor, GovernorCompatibilityBravo, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
500
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
501
|
-
Governor("MyGovernor")␊
|
|
502
|
-
GovernorVotes(_token)␊
|
|
503
|
-
GovernorVotesQuorumFraction(4)␊
|
|
504
|
-
GovernorTimelockControl(_timelock)␊
|
|
505
|
-
{}␊
|
|
506
|
-
␊
|
|
507
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
508
|
-
return 45818; // 1 week␊
|
|
509
|
-
}␊
|
|
510
|
-
␊
|
|
511
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
512
|
-
return 45818; // 1 week␊
|
|
513
|
-
}␊
|
|
514
|
-
␊
|
|
515
|
-
// The following functions are overrides required by Solidity.␊
|
|
516
|
-
␊
|
|
517
|
-
function quorum(uint256 blockNumber)␊
|
|
518
|
-
public␊
|
|
519
|
-
view␊
|
|
520
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
521
|
-
returns (uint256)␊
|
|
522
|
-
{␊
|
|
523
|
-
return super.quorum(blockNumber);␊
|
|
524
|
-
}␊
|
|
525
|
-
␊
|
|
526
|
-
function state(uint256 proposalId)␊
|
|
527
|
-
public␊
|
|
528
|
-
view␊
|
|
529
|
-
override(Governor, IGovernor, GovernorTimelockControl)␊
|
|
530
|
-
returns (ProposalState)␊
|
|
531
|
-
{␊
|
|
532
|
-
return super.state(proposalId);␊
|
|
533
|
-
}␊
|
|
534
|
-
␊
|
|
535
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
536
|
-
public␊
|
|
537
|
-
override(Governor, GovernorCompatibilityBravo, IGovernor)␊
|
|
538
|
-
returns (uint256)␊
|
|
539
|
-
{␊
|
|
540
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
541
|
-
}␊
|
|
542
|
-
␊
|
|
543
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
544
|
-
internal␊
|
|
545
|
-
override(Governor, GovernorTimelockControl)␊
|
|
546
|
-
{␊
|
|
547
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
548
|
-
}␊
|
|
549
|
-
␊
|
|
550
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
551
|
-
internal␊
|
|
552
|
-
override(Governor, GovernorTimelockControl)␊
|
|
553
|
-
returns (uint256)␊
|
|
554
|
-
{␊
|
|
555
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
556
|
-
}␊
|
|
557
|
-
␊
|
|
558
|
-
function _executor()␊
|
|
559
|
-
internal␊
|
|
560
|
-
view␊
|
|
561
|
-
override(Governor, GovernorTimelockControl)␊
|
|
562
|
-
returns (address)␊
|
|
563
|
-
{␊
|
|
564
|
-
return super._executor();␊
|
|
565
|
-
}␊
|
|
566
|
-
␊
|
|
567
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
568
|
-
public␊
|
|
569
|
-
view␊
|
|
570
|
-
override(Governor, IERC165, GovernorTimelockControl)␊
|
|
571
|
-
returns (bool)␊
|
|
572
|
-
{␊
|
|
573
|
-
return super.supportsInterface(interfaceId);␊
|
|
574
|
-
}␊
|
|
575
|
-
}␊
|
|
576
|
-
`
|
|
577
|
-
|
|
578
|
-
## governor with erc20votes
|
|
579
|
-
|
|
580
|
-
> Snapshot 1
|
|
581
|
-
|
|
582
|
-
`// SPDX-License-Identifier: MIT␊
|
|
583
|
-
pragma solidity ^0.8.4;␊
|
|
584
|
-
␊
|
|
585
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
586
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
587
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
588
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
589
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
590
|
-
␊
|
|
591
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
592
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
593
|
-
Governor("MyGovernor")␊
|
|
594
|
-
GovernorVotes(_token)␊
|
|
595
|
-
GovernorVotesQuorumFraction(4)␊
|
|
596
|
-
GovernorTimelockControl(_timelock)␊
|
|
597
|
-
{}␊
|
|
598
|
-
␊
|
|
599
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
600
|
-
return 45818; // 1 week␊
|
|
601
|
-
}␊
|
|
602
|
-
␊
|
|
603
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
604
|
-
return 45818; // 1 week␊
|
|
605
|
-
}␊
|
|
606
|
-
␊
|
|
607
|
-
// The following functions are overrides required by Solidity.␊
|
|
608
|
-
␊
|
|
609
|
-
function quorum(uint256 blockNumber)␊
|
|
610
|
-
public␊
|
|
611
|
-
view␊
|
|
612
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
613
|
-
returns (uint256)␊
|
|
614
|
-
{␊
|
|
615
|
-
return super.quorum(blockNumber);␊
|
|
616
|
-
}␊
|
|
617
|
-
␊
|
|
618
|
-
function state(uint256 proposalId)␊
|
|
619
|
-
public␊
|
|
620
|
-
view␊
|
|
621
|
-
override(Governor, GovernorTimelockControl)␊
|
|
622
|
-
returns (ProposalState)␊
|
|
623
|
-
{␊
|
|
624
|
-
return super.state(proposalId);␊
|
|
625
|
-
}␊
|
|
626
|
-
␊
|
|
627
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
628
|
-
public␊
|
|
629
|
-
override(Governor, IGovernor)␊
|
|
630
|
-
returns (uint256)␊
|
|
631
|
-
{␊
|
|
632
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
633
|
-
}␊
|
|
634
|
-
␊
|
|
635
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
636
|
-
internal␊
|
|
637
|
-
override(Governor, GovernorTimelockControl)␊
|
|
638
|
-
{␊
|
|
639
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
640
|
-
}␊
|
|
641
|
-
␊
|
|
642
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
643
|
-
internal␊
|
|
644
|
-
override(Governor, GovernorTimelockControl)␊
|
|
645
|
-
returns (uint256)␊
|
|
646
|
-
{␊
|
|
647
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
648
|
-
}␊
|
|
649
|
-
␊
|
|
650
|
-
function _executor()␊
|
|
651
|
-
internal␊
|
|
652
|
-
view␊
|
|
653
|
-
override(Governor, GovernorTimelockControl)␊
|
|
654
|
-
returns (address)␊
|
|
655
|
-
{␊
|
|
656
|
-
return super._executor();␊
|
|
657
|
-
}␊
|
|
658
|
-
␊
|
|
659
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
660
|
-
public␊
|
|
661
|
-
view␊
|
|
662
|
-
override(Governor, GovernorTimelockControl)␊
|
|
663
|
-
returns (bool)␊
|
|
664
|
-
{␊
|
|
665
|
-
return super.supportsInterface(interfaceId);␊
|
|
666
|
-
}␊
|
|
667
|
-
}␊
|
|
668
|
-
`
|
|
669
|
-
|
|
670
|
-
## governor with erc721votes
|
|
671
|
-
|
|
672
|
-
> Snapshot 1
|
|
673
|
-
|
|
674
|
-
`// SPDX-License-Identifier: MIT␊
|
|
675
|
-
pragma solidity ^0.8.4;␊
|
|
676
|
-
␊
|
|
677
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
678
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
679
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
680
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
681
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
682
|
-
␊
|
|
683
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
684
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
685
|
-
Governor("MyGovernor")␊
|
|
686
|
-
GovernorVotes(_token)␊
|
|
687
|
-
GovernorVotesQuorumFraction(4)␊
|
|
688
|
-
GovernorTimelockControl(_timelock)␊
|
|
689
|
-
{}␊
|
|
690
|
-
␊
|
|
691
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
692
|
-
return 45818; // 1 week␊
|
|
693
|
-
}␊
|
|
694
|
-
␊
|
|
695
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
696
|
-
return 45818; // 1 week␊
|
|
697
|
-
}␊
|
|
698
|
-
␊
|
|
699
|
-
// The following functions are overrides required by Solidity.␊
|
|
700
|
-
␊
|
|
701
|
-
function quorum(uint256 blockNumber)␊
|
|
702
|
-
public␊
|
|
703
|
-
view␊
|
|
704
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
705
|
-
returns (uint256)␊
|
|
706
|
-
{␊
|
|
707
|
-
return super.quorum(blockNumber);␊
|
|
708
|
-
}␊
|
|
709
|
-
␊
|
|
710
|
-
function state(uint256 proposalId)␊
|
|
711
|
-
public␊
|
|
712
|
-
view␊
|
|
713
|
-
override(Governor, GovernorTimelockControl)␊
|
|
714
|
-
returns (ProposalState)␊
|
|
715
|
-
{␊
|
|
716
|
-
return super.state(proposalId);␊
|
|
717
|
-
}␊
|
|
718
|
-
␊
|
|
719
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
720
|
-
public␊
|
|
721
|
-
override(Governor, IGovernor)␊
|
|
722
|
-
returns (uint256)␊
|
|
723
|
-
{␊
|
|
724
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
725
|
-
}␊
|
|
726
|
-
␊
|
|
727
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
728
|
-
internal␊
|
|
729
|
-
override(Governor, GovernorTimelockControl)␊
|
|
730
|
-
{␊
|
|
731
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
732
|
-
}␊
|
|
733
|
-
␊
|
|
734
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
735
|
-
internal␊
|
|
736
|
-
override(Governor, GovernorTimelockControl)␊
|
|
737
|
-
returns (uint256)␊
|
|
738
|
-
{␊
|
|
739
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
740
|
-
}␊
|
|
741
|
-
␊
|
|
742
|
-
function _executor()␊
|
|
743
|
-
internal␊
|
|
744
|
-
view␊
|
|
745
|
-
override(Governor, GovernorTimelockControl)␊
|
|
746
|
-
returns (address)␊
|
|
747
|
-
{␊
|
|
748
|
-
return super._executor();␊
|
|
749
|
-
}␊
|
|
750
|
-
␊
|
|
751
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
752
|
-
public␊
|
|
753
|
-
view␊
|
|
754
|
-
override(Governor, GovernorTimelockControl)␊
|
|
755
|
-
returns (bool)␊
|
|
756
|
-
{␊
|
|
757
|
-
return super.supportsInterface(interfaceId);␊
|
|
758
|
-
}␊
|
|
759
|
-
}␊
|
|
760
|
-
`
|
|
761
|
-
|
|
762
|
-
## governor with erc721votes omit decimals
|
|
763
|
-
|
|
764
|
-
> Snapshot 1
|
|
765
|
-
|
|
766
|
-
`// SPDX-License-Identifier: MIT␊
|
|
767
|
-
pragma solidity ^0.8.4;␊
|
|
768
|
-
␊
|
|
769
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
770
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
771
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
772
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
773
|
-
␊
|
|
774
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorTimelockControl {␊
|
|
775
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
776
|
-
Governor("MyGovernor")␊
|
|
777
|
-
GovernorVotes(_token)␊
|
|
778
|
-
GovernorTimelockControl(_timelock)␊
|
|
779
|
-
{}␊
|
|
780
|
-
␊
|
|
781
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
782
|
-
return 45818; // 1 week␊
|
|
783
|
-
}␊
|
|
784
|
-
␊
|
|
785
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
786
|
-
return 45818; // 1 week␊
|
|
787
|
-
}␊
|
|
788
|
-
␊
|
|
789
|
-
function quorum(uint256 blockNumber) public pure override returns (uint256) {␊
|
|
790
|
-
return 5;␊
|
|
791
|
-
}␊
|
|
792
|
-
␊
|
|
793
|
-
function proposalThreshold() public pure override returns (uint256) {␊
|
|
794
|
-
return 1;␊
|
|
795
|
-
}␊
|
|
796
|
-
␊
|
|
797
|
-
// The following functions are overrides required by Solidity.␊
|
|
798
|
-
␊
|
|
799
|
-
function state(uint256 proposalId)␊
|
|
800
|
-
public␊
|
|
801
|
-
view␊
|
|
802
|
-
override(Governor, GovernorTimelockControl)␊
|
|
803
|
-
returns (ProposalState)␊
|
|
804
|
-
{␊
|
|
805
|
-
return super.state(proposalId);␊
|
|
806
|
-
}␊
|
|
807
|
-
␊
|
|
808
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
809
|
-
public␊
|
|
810
|
-
override(Governor, IGovernor)␊
|
|
811
|
-
returns (uint256)␊
|
|
812
|
-
{␊
|
|
813
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
814
|
-
}␊
|
|
815
|
-
␊
|
|
816
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
817
|
-
internal␊
|
|
818
|
-
override(Governor, GovernorTimelockControl)␊
|
|
819
|
-
{␊
|
|
820
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
821
|
-
}␊
|
|
822
|
-
␊
|
|
823
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
824
|
-
internal␊
|
|
825
|
-
override(Governor, GovernorTimelockControl)␊
|
|
826
|
-
returns (uint256)␊
|
|
827
|
-
{␊
|
|
828
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
829
|
-
}␊
|
|
830
|
-
␊
|
|
831
|
-
function _executor()␊
|
|
832
|
-
internal␊
|
|
833
|
-
view␊
|
|
834
|
-
override(Governor, GovernorTimelockControl)␊
|
|
835
|
-
returns (address)␊
|
|
836
|
-
{␊
|
|
837
|
-
return super._executor();␊
|
|
838
|
-
}␊
|
|
839
|
-
␊
|
|
840
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
841
|
-
public␊
|
|
842
|
-
view␊
|
|
843
|
-
override(Governor, GovernorTimelockControl)␊
|
|
844
|
-
returns (bool)␊
|
|
845
|
-
{␊
|
|
846
|
-
return super.supportsInterface(interfaceId);␊
|
|
847
|
-
}␊
|
|
848
|
-
}␊
|
|
849
|
-
`
|
|
850
|
-
|
|
851
|
-
## governor with erc721votes settings omit decimals
|
|
852
|
-
|
|
853
|
-
> Snapshot 1
|
|
854
|
-
|
|
855
|
-
`// SPDX-License-Identifier: MIT␊
|
|
856
|
-
pragma solidity ^0.8.4;␊
|
|
857
|
-
␊
|
|
858
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
859
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";␊
|
|
860
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
861
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
862
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
863
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
864
|
-
␊
|
|
865
|
-
contract MyGovernor is Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
866
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
867
|
-
Governor("MyGovernor")␊
|
|
868
|
-
GovernorSettings(45818 /* 1 week */, 45818 /* 1 week */, 10)␊
|
|
869
|
-
GovernorVotes(_token)␊
|
|
870
|
-
GovernorVotesQuorumFraction(4)␊
|
|
871
|
-
GovernorTimelockControl(_timelock)␊
|
|
872
|
-
{}␊
|
|
873
|
-
␊
|
|
874
|
-
// The following functions are overrides required by Solidity.␊
|
|
875
|
-
␊
|
|
876
|
-
function votingDelay()␊
|
|
877
|
-
public␊
|
|
878
|
-
view␊
|
|
879
|
-
override(IGovernor, GovernorSettings)␊
|
|
880
|
-
returns (uint256)␊
|
|
881
|
-
{␊
|
|
882
|
-
return super.votingDelay();␊
|
|
883
|
-
}␊
|
|
884
|
-
␊
|
|
885
|
-
function votingPeriod()␊
|
|
886
|
-
public␊
|
|
887
|
-
view␊
|
|
888
|
-
override(IGovernor, GovernorSettings)␊
|
|
889
|
-
returns (uint256)␊
|
|
890
|
-
{␊
|
|
891
|
-
return super.votingPeriod();␊
|
|
892
|
-
}␊
|
|
893
|
-
␊
|
|
894
|
-
function quorum(uint256 blockNumber)␊
|
|
895
|
-
public␊
|
|
896
|
-
view␊
|
|
897
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
898
|
-
returns (uint256)␊
|
|
899
|
-
{␊
|
|
900
|
-
return super.quorum(blockNumber);␊
|
|
901
|
-
}␊
|
|
902
|
-
␊
|
|
903
|
-
function state(uint256 proposalId)␊
|
|
904
|
-
public␊
|
|
905
|
-
view␊
|
|
906
|
-
override(Governor, GovernorTimelockControl)␊
|
|
907
|
-
returns (ProposalState)␊
|
|
908
|
-
{␊
|
|
909
|
-
return super.state(proposalId);␊
|
|
910
|
-
}␊
|
|
911
|
-
␊
|
|
912
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
913
|
-
public␊
|
|
914
|
-
override(Governor, IGovernor)␊
|
|
915
|
-
returns (uint256)␊
|
|
916
|
-
{␊
|
|
917
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
918
|
-
}␊
|
|
919
|
-
␊
|
|
920
|
-
function proposalThreshold()␊
|
|
921
|
-
public␊
|
|
922
|
-
view␊
|
|
923
|
-
override(Governor, GovernorSettings)␊
|
|
924
|
-
returns (uint256)␊
|
|
925
|
-
{␊
|
|
926
|
-
return super.proposalThreshold();␊
|
|
927
|
-
}␊
|
|
928
|
-
␊
|
|
929
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
930
|
-
internal␊
|
|
931
|
-
override(Governor, GovernorTimelockControl)␊
|
|
932
|
-
{␊
|
|
933
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
934
|
-
}␊
|
|
935
|
-
␊
|
|
936
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
937
|
-
internal␊
|
|
938
|
-
override(Governor, GovernorTimelockControl)␊
|
|
939
|
-
returns (uint256)␊
|
|
940
|
-
{␊
|
|
941
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
942
|
-
}␊
|
|
943
|
-
␊
|
|
944
|
-
function _executor()␊
|
|
945
|
-
internal␊
|
|
946
|
-
view␊
|
|
947
|
-
override(Governor, GovernorTimelockControl)␊
|
|
948
|
-
returns (address)␊
|
|
949
|
-
{␊
|
|
950
|
-
return super._executor();␊
|
|
951
|
-
}␊
|
|
952
|
-
␊
|
|
953
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
954
|
-
public␊
|
|
955
|
-
view␊
|
|
956
|
-
override(Governor, GovernorTimelockControl)␊
|
|
957
|
-
returns (bool)␊
|
|
958
|
-
{␊
|
|
959
|
-
return super.supportsInterface(interfaceId);␊
|
|
960
|
-
}␊
|
|
961
|
-
}␊
|
|
962
|
-
`
|
|
963
|
-
|
|
964
|
-
## governor with comp
|
|
965
|
-
|
|
966
|
-
> Snapshot 1
|
|
967
|
-
|
|
968
|
-
`// SPDX-License-Identifier: MIT␊
|
|
969
|
-
pragma solidity ^0.8.4;␊
|
|
970
|
-
␊
|
|
971
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
972
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
973
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesComp.sol";␊
|
|
974
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
975
|
-
␊
|
|
976
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotesComp, GovernorTimelockControl {␊
|
|
977
|
-
constructor(ERC20VotesComp _token, TimelockController _timelock)␊
|
|
978
|
-
Governor("MyGovernor")␊
|
|
979
|
-
GovernorVotesComp(_token)␊
|
|
980
|
-
GovernorTimelockControl(_timelock)␊
|
|
981
|
-
{}␊
|
|
982
|
-
␊
|
|
983
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
984
|
-
return 45818; // 1 week␊
|
|
985
|
-
}␊
|
|
986
|
-
␊
|
|
987
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
988
|
-
return 45818; // 1 week␊
|
|
989
|
-
}␊
|
|
990
|
-
␊
|
|
991
|
-
function quorum(uint256 blockNumber) public pure override returns (uint256) {␊
|
|
992
|
-
return 1e18;␊
|
|
993
|
-
}␊
|
|
994
|
-
␊
|
|
995
|
-
// The following functions are overrides required by Solidity.␊
|
|
996
|
-
␊
|
|
997
|
-
function state(uint256 proposalId)␊
|
|
998
|
-
public␊
|
|
999
|
-
view␊
|
|
1000
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1001
|
-
returns (ProposalState)␊
|
|
1002
|
-
{␊
|
|
1003
|
-
return super.state(proposalId);␊
|
|
1004
|
-
}␊
|
|
1005
|
-
␊
|
|
1006
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
1007
|
-
public␊
|
|
1008
|
-
override(Governor, IGovernor)␊
|
|
1009
|
-
returns (uint256)␊
|
|
1010
|
-
{␊
|
|
1011
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
1012
|
-
}␊
|
|
1013
|
-
␊
|
|
1014
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1015
|
-
internal␊
|
|
1016
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1017
|
-
{␊
|
|
1018
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
1019
|
-
}␊
|
|
1020
|
-
␊
|
|
1021
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1022
|
-
internal␊
|
|
1023
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1024
|
-
returns (uint256)␊
|
|
1025
|
-
{␊
|
|
1026
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
1027
|
-
}␊
|
|
1028
|
-
␊
|
|
1029
|
-
function _executor()␊
|
|
1030
|
-
internal␊
|
|
1031
|
-
view␊
|
|
1032
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1033
|
-
returns (address)␊
|
|
1034
|
-
{␊
|
|
1035
|
-
return super._executor();␊
|
|
1036
|
-
}␊
|
|
1037
|
-
␊
|
|
1038
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
1039
|
-
public␊
|
|
1040
|
-
view␊
|
|
1041
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1042
|
-
returns (bool)␊
|
|
1043
|
-
{␊
|
|
1044
|
-
return super.supportsInterface(interfaceId);␊
|
|
1045
|
-
}␊
|
|
1046
|
-
}␊
|
|
1047
|
-
`
|
|
1048
|
-
|
|
1049
|
-
## governor with percent quorum
|
|
1050
|
-
|
|
1051
|
-
> Snapshot 1
|
|
1052
|
-
|
|
1053
|
-
`// SPDX-License-Identifier: MIT␊
|
|
1054
|
-
pragma solidity ^0.8.4;␊
|
|
1055
|
-
␊
|
|
1056
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
1057
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
1058
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
1059
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
1060
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
1061
|
-
␊
|
|
1062
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
1063
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
1064
|
-
Governor("MyGovernor")␊
|
|
1065
|
-
GovernorVotes(_token)␊
|
|
1066
|
-
GovernorVotesQuorumFraction(6)␊
|
|
1067
|
-
GovernorTimelockControl(_timelock)␊
|
|
1068
|
-
{}␊
|
|
1069
|
-
␊
|
|
1070
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
1071
|
-
return 45818; // 1 week␊
|
|
1072
|
-
}␊
|
|
1073
|
-
␊
|
|
1074
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
1075
|
-
return 45818; // 1 week␊
|
|
1076
|
-
}␊
|
|
1077
|
-
␊
|
|
1078
|
-
// The following functions are overrides required by Solidity.␊
|
|
1079
|
-
␊
|
|
1080
|
-
function quorum(uint256 blockNumber)␊
|
|
1081
|
-
public␊
|
|
1082
|
-
view␊
|
|
1083
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
1084
|
-
returns (uint256)␊
|
|
1085
|
-
{␊
|
|
1086
|
-
return super.quorum(blockNumber);␊
|
|
1087
|
-
}␊
|
|
1088
|
-
␊
|
|
1089
|
-
function state(uint256 proposalId)␊
|
|
1090
|
-
public␊
|
|
1091
|
-
view␊
|
|
1092
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1093
|
-
returns (ProposalState)␊
|
|
1094
|
-
{␊
|
|
1095
|
-
return super.state(proposalId);␊
|
|
1096
|
-
}␊
|
|
1097
|
-
␊
|
|
1098
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
1099
|
-
public␊
|
|
1100
|
-
override(Governor, IGovernor)␊
|
|
1101
|
-
returns (uint256)␊
|
|
1102
|
-
{␊
|
|
1103
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
1104
|
-
}␊
|
|
1105
|
-
␊
|
|
1106
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1107
|
-
internal␊
|
|
1108
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1109
|
-
{␊
|
|
1110
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
1111
|
-
}␊
|
|
1112
|
-
␊
|
|
1113
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1114
|
-
internal␊
|
|
1115
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1116
|
-
returns (uint256)␊
|
|
1117
|
-
{␊
|
|
1118
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
1119
|
-
}␊
|
|
1120
|
-
␊
|
|
1121
|
-
function _executor()␊
|
|
1122
|
-
internal␊
|
|
1123
|
-
view␊
|
|
1124
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1125
|
-
returns (address)␊
|
|
1126
|
-
{␊
|
|
1127
|
-
return super._executor();␊
|
|
1128
|
-
}␊
|
|
1129
|
-
␊
|
|
1130
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
1131
|
-
public␊
|
|
1132
|
-
view␊
|
|
1133
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1134
|
-
returns (bool)␊
|
|
1135
|
-
{␊
|
|
1136
|
-
return super.supportsInterface(interfaceId);␊
|
|
1137
|
-
}␊
|
|
1138
|
-
}␊
|
|
1139
|
-
`
|
|
1140
|
-
|
|
1141
|
-
## governor with fractional percent quorum
|
|
1142
|
-
|
|
1143
|
-
> Snapshot 1
|
|
1144
|
-
|
|
1145
|
-
`// SPDX-License-Identifier: MIT␊
|
|
1146
|
-
pragma solidity ^0.8.4;␊
|
|
1147
|
-
␊
|
|
1148
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
1149
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
1150
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
1151
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
1152
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
1153
|
-
␊
|
|
1154
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
1155
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
1156
|
-
Governor("MyGovernor")␊
|
|
1157
|
-
GovernorVotes(_token)␊
|
|
1158
|
-
GovernorVotesQuorumFraction(5)␊
|
|
1159
|
-
GovernorTimelockControl(_timelock)␊
|
|
1160
|
-
{}␊
|
|
1161
|
-
␊
|
|
1162
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
1163
|
-
return 45818; // 1 week␊
|
|
1164
|
-
}␊
|
|
1165
|
-
␊
|
|
1166
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
1167
|
-
return 45818; // 1 week␊
|
|
1168
|
-
}␊
|
|
1169
|
-
␊
|
|
1170
|
-
function quorumDenominator() public pure override returns (uint256) {␊
|
|
1171
|
-
return 1000;␊
|
|
1172
|
-
}␊
|
|
1173
|
-
␊
|
|
1174
|
-
// The following functions are overrides required by Solidity.␊
|
|
1175
|
-
␊
|
|
1176
|
-
function quorum(uint256 blockNumber)␊
|
|
1177
|
-
public␊
|
|
1178
|
-
view␊
|
|
1179
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
1180
|
-
returns (uint256)␊
|
|
1181
|
-
{␊
|
|
1182
|
-
return super.quorum(blockNumber);␊
|
|
1183
|
-
}␊
|
|
1184
|
-
␊
|
|
1185
|
-
function state(uint256 proposalId)␊
|
|
1186
|
-
public␊
|
|
1187
|
-
view␊
|
|
1188
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1189
|
-
returns (ProposalState)␊
|
|
1190
|
-
{␊
|
|
1191
|
-
return super.state(proposalId);␊
|
|
1192
|
-
}␊
|
|
1193
|
-
␊
|
|
1194
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
1195
|
-
public␊
|
|
1196
|
-
override(Governor, IGovernor)␊
|
|
1197
|
-
returns (uint256)␊
|
|
1198
|
-
{␊
|
|
1199
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
1200
|
-
}␊
|
|
1201
|
-
␊
|
|
1202
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1203
|
-
internal␊
|
|
1204
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1205
|
-
{␊
|
|
1206
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
1207
|
-
}␊
|
|
1208
|
-
␊
|
|
1209
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1210
|
-
internal␊
|
|
1211
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1212
|
-
returns (uint256)␊
|
|
1213
|
-
{␊
|
|
1214
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
1215
|
-
}␊
|
|
1216
|
-
␊
|
|
1217
|
-
function _executor()␊
|
|
1218
|
-
internal␊
|
|
1219
|
-
view␊
|
|
1220
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1221
|
-
returns (address)␊
|
|
1222
|
-
{␊
|
|
1223
|
-
return super._executor();␊
|
|
1224
|
-
}␊
|
|
1225
|
-
␊
|
|
1226
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
1227
|
-
public␊
|
|
1228
|
-
view␊
|
|
1229
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1230
|
-
returns (bool)␊
|
|
1231
|
-
{␊
|
|
1232
|
-
return super.supportsInterface(interfaceId);␊
|
|
1233
|
-
}␊
|
|
1234
|
-
}␊
|
|
1235
|
-
`
|
|
1236
|
-
|
|
1237
|
-
## governor with openzeppelin timelock
|
|
1238
|
-
|
|
1239
|
-
> Snapshot 1
|
|
1240
|
-
|
|
1241
|
-
`// SPDX-License-Identifier: MIT␊
|
|
1242
|
-
pragma solidity ^0.8.4;␊
|
|
1243
|
-
␊
|
|
1244
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
1245
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
1246
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
1247
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
1248
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";␊
|
|
1249
|
-
␊
|
|
1250
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {␊
|
|
1251
|
-
constructor(IVotes _token, TimelockController _timelock)␊
|
|
1252
|
-
Governor("MyGovernor")␊
|
|
1253
|
-
GovernorVotes(_token)␊
|
|
1254
|
-
GovernorVotesQuorumFraction(4)␊
|
|
1255
|
-
GovernorTimelockControl(_timelock)␊
|
|
1256
|
-
{}␊
|
|
1257
|
-
␊
|
|
1258
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
1259
|
-
return 45818; // 1 week␊
|
|
1260
|
-
}␊
|
|
1261
|
-
␊
|
|
1262
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
1263
|
-
return 45818; // 1 week␊
|
|
1264
|
-
}␊
|
|
1265
|
-
␊
|
|
1266
|
-
// The following functions are overrides required by Solidity.␊
|
|
1267
|
-
␊
|
|
1268
|
-
function quorum(uint256 blockNumber)␊
|
|
1269
|
-
public␊
|
|
1270
|
-
view␊
|
|
1271
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
1272
|
-
returns (uint256)␊
|
|
1273
|
-
{␊
|
|
1274
|
-
return super.quorum(blockNumber);␊
|
|
1275
|
-
}␊
|
|
1276
|
-
␊
|
|
1277
|
-
function state(uint256 proposalId)␊
|
|
1278
|
-
public␊
|
|
1279
|
-
view␊
|
|
1280
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1281
|
-
returns (ProposalState)␊
|
|
1282
|
-
{␊
|
|
1283
|
-
return super.state(proposalId);␊
|
|
1284
|
-
}␊
|
|
1285
|
-
␊
|
|
1286
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
1287
|
-
public␊
|
|
1288
|
-
override(Governor, IGovernor)␊
|
|
1289
|
-
returns (uint256)␊
|
|
1290
|
-
{␊
|
|
1291
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
1292
|
-
}␊
|
|
1293
|
-
␊
|
|
1294
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1295
|
-
internal␊
|
|
1296
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1297
|
-
{␊
|
|
1298
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
1299
|
-
}␊
|
|
1300
|
-
␊
|
|
1301
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1302
|
-
internal␊
|
|
1303
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1304
|
-
returns (uint256)␊
|
|
1305
|
-
{␊
|
|
1306
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
1307
|
-
}␊
|
|
1308
|
-
␊
|
|
1309
|
-
function _executor()␊
|
|
1310
|
-
internal␊
|
|
1311
|
-
view␊
|
|
1312
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1313
|
-
returns (address)␊
|
|
1314
|
-
{␊
|
|
1315
|
-
return super._executor();␊
|
|
1316
|
-
}␊
|
|
1317
|
-
␊
|
|
1318
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
1319
|
-
public␊
|
|
1320
|
-
view␊
|
|
1321
|
-
override(Governor, GovernorTimelockControl)␊
|
|
1322
|
-
returns (bool)␊
|
|
1323
|
-
{␊
|
|
1324
|
-
return super.supportsInterface(interfaceId);␊
|
|
1325
|
-
}␊
|
|
1326
|
-
}␊
|
|
1327
|
-
`
|
|
1328
|
-
|
|
1329
|
-
## governor with compound timelock
|
|
1330
|
-
|
|
1331
|
-
> Snapshot 1
|
|
1332
|
-
|
|
1333
|
-
`// SPDX-License-Identifier: MIT␊
|
|
1334
|
-
pragma solidity ^0.8.4;␊
|
|
1335
|
-
␊
|
|
1336
|
-
import "@openzeppelin/contracts/governance/Governor.sol";␊
|
|
1337
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";␊
|
|
1338
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";␊
|
|
1339
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";␊
|
|
1340
|
-
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockCompound.sol";␊
|
|
1341
|
-
␊
|
|
1342
|
-
contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockCompound {␊
|
|
1343
|
-
constructor(IVotes _token, ICompoundTimelock _timelock)␊
|
|
1344
|
-
Governor("MyGovernor")␊
|
|
1345
|
-
GovernorVotes(_token)␊
|
|
1346
|
-
GovernorVotesQuorumFraction(4)␊
|
|
1347
|
-
GovernorTimelockCompound(_timelock)␊
|
|
1348
|
-
{}␊
|
|
1349
|
-
␊
|
|
1350
|
-
function votingDelay() public pure override returns (uint256) {␊
|
|
1351
|
-
return 45818; // 1 week␊
|
|
1352
|
-
}␊
|
|
1353
|
-
␊
|
|
1354
|
-
function votingPeriod() public pure override returns (uint256) {␊
|
|
1355
|
-
return 45818; // 1 week␊
|
|
1356
|
-
}␊
|
|
1357
|
-
␊
|
|
1358
|
-
// The following functions are overrides required by Solidity.␊
|
|
1359
|
-
␊
|
|
1360
|
-
function quorum(uint256 blockNumber)␊
|
|
1361
|
-
public␊
|
|
1362
|
-
view␊
|
|
1363
|
-
override(IGovernor, GovernorVotesQuorumFraction)␊
|
|
1364
|
-
returns (uint256)␊
|
|
1365
|
-
{␊
|
|
1366
|
-
return super.quorum(blockNumber);␊
|
|
1367
|
-
}␊
|
|
1368
|
-
␊
|
|
1369
|
-
function state(uint256 proposalId)␊
|
|
1370
|
-
public␊
|
|
1371
|
-
view␊
|
|
1372
|
-
override(Governor, GovernorTimelockCompound)␊
|
|
1373
|
-
returns (ProposalState)␊
|
|
1374
|
-
{␊
|
|
1375
|
-
return super.state(proposalId);␊
|
|
1376
|
-
}␊
|
|
1377
|
-
␊
|
|
1378
|
-
function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)␊
|
|
1379
|
-
public␊
|
|
1380
|
-
override(Governor, IGovernor)␊
|
|
1381
|
-
returns (uint256)␊
|
|
1382
|
-
{␊
|
|
1383
|
-
return super.propose(targets, values, calldatas, description);␊
|
|
1384
|
-
}␊
|
|
1385
|
-
␊
|
|
1386
|
-
function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1387
|
-
internal␊
|
|
1388
|
-
override(Governor, GovernorTimelockCompound)␊
|
|
1389
|
-
{␊
|
|
1390
|
-
super._execute(proposalId, targets, values, calldatas, descriptionHash);␊
|
|
1391
|
-
}␊
|
|
1392
|
-
␊
|
|
1393
|
-
function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)␊
|
|
1394
|
-
internal␊
|
|
1395
|
-
override(Governor, GovernorTimelockCompound)␊
|
|
1396
|
-
returns (uint256)␊
|
|
1397
|
-
{␊
|
|
1398
|
-
return super._cancel(targets, values, calldatas, descriptionHash);␊
|
|
1399
|
-
}␊
|
|
1400
|
-
␊
|
|
1401
|
-
function _executor()␊
|
|
1402
|
-
internal␊
|
|
1403
|
-
view␊
|
|
1404
|
-
override(Governor, GovernorTimelockCompound)␊
|
|
1405
|
-
returns (address)␊
|
|
1406
|
-
{␊
|
|
1407
|
-
return super._executor();␊
|
|
1408
|
-
}␊
|
|
1409
|
-
␊
|
|
1410
|
-
function supportsInterface(bytes4 interfaceId)␊
|
|
1411
|
-
public␊
|
|
1412
|
-
view␊
|
|
1413
|
-
override(Governor, GovernorTimelockCompound)␊
|
|
1414
|
-
returns (bool)␊
|
|
1415
|
-
{␊
|
|
1416
|
-
return super.supportsInterface(interfaceId);␊
|
|
1417
|
-
}␊
|
|
1418
|
-
}␊
|
|
1419
|
-
`
|