-
Notifications
You must be signed in to change notification settings - Fork 0
/
Proposal-Store.sol
55 lines (41 loc) · 1.88 KB
/
Proposal-Store.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// This is an evil token. Whenever an A -> B transfer is called, half of the amount goes to B
// and half to a predefined C
contract ProposalStore {
// @notice Ballot receipt record for a voter
// Proposal[] private proposals;
struct Proposal {
// @notice Unique id for looking up a proposal
uint id;
string title;
string desc;
// @notice the ordered list of target addresses for calls to be made
address[] targets;
uint[] values;
// @notice The ordered list of function signatures to be called
string[] signatures;
// @notice The ordered list of calldata to be passed to each call
bytes[] calldatas;
}
address private UniGovModAcct;
mapping(uint => Proposal) private proposals;
constructor(uint propId, string memory title, string memory desc, address[] memory targets,
uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
UniGovModAcct = msg.sender;
Proposal memory prop = Proposal(propId, title, desc, targets, values, signatures, calldatas);
proposals[propId] = prop;
}
function AddProposal(uint propId, string memory title, string memory desc, address[] memory targets,
uint[] memory values, string[] memory signatures, bytes[] memory calldatas) public {
require(msg.sender == UniGovModAcct);
Proposal memory newProp = Proposal(propId, title, desc, targets, values, signatures, calldatas);
proposals[propId] = newProp;
}
function QueryProp(uint propId) public view returns(Proposal memory){
if (proposals[propId].id == propId) {
return proposals[propId];
}
return Proposal(0, "", "", new address[](0), new uint[](0), new string[](0), new bytes[](0));
}
}