304 txs
304 calls
constructor
constructor(address _verifier)
functions
getProposalInfo
viewfunction getProposalInfo(uint256 _proposalId) view returns (tuple proposal)
getUserVote
viewfunction getUserVote(uint256 _proposalId, address _user) view returns (string)
getVotingResult
viewfunction getVotingResult(uint256 _proposalId) view returns (string)
idToProposalInfo
viewfunction idToProposalInfo(uint256) view returns (uint256 startTimestamp, uint256 endTimestamp, bool open)
isAdmin
viewfunction isAdmin(address _admin) view returns (bool)
openProposalsIds
viewfunction openProposalsIds(uint256) view returns (uint256)
owner
viewfunction owner() view returns (address)
verifier
viewfunction verifier() view returns (address)
addAdmin
nonpayablefunction addAdmin(address _admin)
closeProposalsBatch
nonpayablefunction closeProposalsBatch(uint256[] _ids)
createNewProposal
nonpayablefunction createNewProposal(uint256 _proposalId, uint256 _startTimestamp, uint256 _endTimestamp, string[] _choices)
removeAdmin
nonpayablefunction removeAdmin(address _admin)
renounceOwnership
nonpayablefunction renounceOwnership()
submitVote
nonpayablefunction submitVote(uint256 _tokenId, uint256 _proposalId, uint256 _choice, bytes _data)
transferOwnership
nonpayablefunction transferOwnership(address newOwner)
events
AdminAdded
event AdminAdded(address indexed admin)
AdminRemoved
event AdminRemoved(address indexed admin)
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Voted
event Voted(address indexed user, uint256 indexed proposalId, uint256 indexed choice, bytes data)
VotingClosed
event VotingClosed(uint256 indexed proposalId)
VotingOpened
event VotingOpened(uint256 indexed proposalId)
errors
AdminAlreadyExists
error AdminAlreadyExists(address admin)
AdminDoesNotExist
error AdminDoesNotExist(address admin)
AdminIsAddressZero
error AdminIsAddressZero()
CallerIsNotTheAdmin
error CallerIsNotTheAdmin(address caller)
InvalidProposalId
error InvalidProposalId(uint256 proposalId)
InvalidTimestamp
error InvalidTimestamp(uint256 timestamp)
LessThanTwoChoices
error LessThanTwoChoices()
ProposalAlreadyExists
error ProposalAlreadyExists(uint256 proposalId)
UserHasNotVotedYet
error UserHasNotVotedYet()
VerificationFailed
error VerificationFailed()
VotingIsClosed
error VotingIsClosed(uint256 proposalId)
VotingIsOpened
error VotingIsOpened(uint256 proposalId)
VotingNotStarted
error VotingNotStarted(uint256 proposalId)
WrongChoice
error WrongChoice(uint256 choiceId)
creation bytecode
0x60a060405234801561001057600080fd5b5060405161188c38038061188c83398101604081905261002f91610099565b61003833610049565b6001600160a01b03166080526100c9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100ab57600080fd5b81516001600160a01b03811681146100c257600080fd5b9392505050565b6080516117a16100eb6000396000818161017301526107f201526117a16000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806366babdb911610097578063bc903cb811610066578063bc903cb814610220578063cb8357cd14610240578063f2fde38b14610253578063fe2099b01461026657600080fd5b806366babdb9146101d357806370480275146101f4578063715018a6146102075780638da5cb5b1461020f57600080fd5b806324d7806c116100d357806324d7806c1461014b5780632b7ac3f31461016e578063563a106f146101ad57806363af4234146101c057600080fd5b806303c7881a146100fa5780631785f53c146101235780631c0d850e14610138575b600080fd5b61010d6101083660046110f7565b6102b5565b60405161011a9190611169565b60405180910390f35b610136610131366004611183565b61040a565b005b61010d61014636600461119e565b6104c6565b61015e610159366004611183565b610615565b604051901515815260200161011a565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161011a565b6101366101bb3660046111b7565b61064c565b6101366101ce36600461122c565b61070a565b6101e66101e136600461119e565b61094a565b60405190815260200161011a565b610136610202366004611183565b61096b565b610136610a2e565b6000546001600160a01b0316610195565b61023361022e36600461119e565b610a42565b60405161011a91906112f5565b61013661024e3660046113e5565b610be1565b610136610261366004611183565b610d98565b61029861027436600461119e565b60036020526000908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600161011a565b60008281526005602090815260408083206001600160a01b038516845290915290205460609060ff166102fb57604051631b795af160e01b815260040160405180910390fd5b6000838152600360205260408120805490910361033357604051630d30dcf560e41b8152600481018590526024015b60405180910390fd5b60008481526004602090815260408083206001600160a01b03871684529091529020546003820180548290811061036c5761036c611519565b9060005260206000200180546103819061152f565b80601f01602080910402602001604051908101604052809291908181526020018280546103ad9061152f565b80156103fa5780601f106103cf576101008083540402835291602001916103fa565b820191906000526020600020905b8154815290600101906020018083116103dd57829003601f168201915b5050505050925050505b92915050565b610412610e11565b6001600160a01b0381166104395760405163274338ef60e11b815260040160405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff1661047d57604051630ed580c760e41b81526001600160a01b038216600482015260240161032a565b6001600160a01b038116600081815260016020526040808220805460ff19169055517fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f9190a250565b60008181526003602052604081208054606092036104fa57604051630d30dcf560e41b81526004810184905260240161032a565b6003810154600080805b83811015610561578185600401828154811061052257610522611519565b906000526020600020015411156105595784600401818154811061054857610548611519565b906000526020600020015491508092505b600101610504565b5083600301828154811061057757610577611519565b90600052602060002001805461058c9061152f565b80601f01602080910402602001604051908101604052809291908181526020018280546105b89061152f565b80156106055780601f106105da57610100808354040283529160200191610605565b820191906000526020600020905b8154815290600101906020018083116105e857829003601f168201915b5050505050945050505050919050565b6001600160a01b03811660009081526001602052604081205460ff16806104045750506000546001600160a01b0391821691161490565b61065533610e6b565b60005b8181101561070557600083838381811061067457610674611519565b6020908102929092013560008181526003909352604090922060028101549293509160ff1690506106bb5760405163dd16587f60e01b81526004810183905260240161032a565b6106c482610ecb565b60028101805460ff1916905560405182907f8e9b46a70b3967bc9ea56ca61732c363a191fac88ae3ba011f4e030711c9011790600090a25050600101610658565b505050565b8360000361072e57604051630d30dcf560e41b81526004810185905260240161032a565b6000848152600360205260409020600281015460ff166107645760405163dd16587f60e01b81526004810186905260240161032a565b80544210156107895760405163bc2e28fb60e01b81526004810186905260240161032a565b80600101544211156107b15760405163dd16587f60e01b81526004810186905260240161032a565b600381015484106107d857604051630f270c3b60e21b81526004810185905260240161032a565b6040516301bdd4c160e31b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630deea6089061082f9033908b908b908a908a90600401611592565b6020604051808303816000875af115801561084e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087291906115cb565b9050806108925760405163439cc0cd60e01b815260040160405180910390fd5b60018260040186815481106108a9576108a9611519565b9060005260206000200160008282546108c29190611603565b90915550506000868152600460209081526040808320338085529083528184208990558984526005835281842081855290925291829020805460ff191660011790559051869188917ffe0ccbc171a3a491a67a3ee5c2ba64c68d2a96b3ed3dd69be38bade0d14ebcd0906109399089908990611616565b60405180910390a450505050505050565b6002818154811061095a57600080fd5b600091825260209091200154905081565b610973610e11565b6001600160a01b03811661099a5760405163274338ef60e11b815260040160405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff16156109df5760405163f646f2cd60e01b81526001600160a01b038216600482015260240161032a565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e3399190a250565b610a36610e11565b610a406000610f82565b565b610a766040518060a00160405280600081526020016000815260200160001515815260200160608152602001606081525090565b6000828152600360208181526040808420815160a08101835281548152600182015481850152600282015460ff16151581840152938101805483518186028101860190945280845291958694606087019493919084015b82821015610b79578382906000526020600020018054610aec9061152f565b80601f0160208091040260200160405190810160405280929190818152602001828054610b189061152f565b8015610b655780601f10610b3a57610100808354040283529160200191610b65565b820191906000526020600020905b815481529060010190602001808311610b4857829003601f168201915b505050505081526020019060010190610acd565b50505050815260200160048201805480602002602001604051908101604052809291908181526020018280548015610bd057602002820191906000526020600020905b815481526020019060010190808311610bbc575b505050505081525050915050919050565b610bea33610e6b565b600084815260036020526040812090859003610c1c57604051630d30dcf560e41b81526004810186905260240161032a565b805415610c3f576040516312dba68f60e01b81526004810186905260240161032a565b42841015610c63576040516304b8410560e31b81526004810185905260240161032a565b83831015610c87576040516304b8410560e31b81526004810184905260240161032a565b600282511015610caa57604051632ab9be1960e11b815260040160405180910390fd5b60028101805460ff1916600190811790915584825581018390558151610cd99060038301906020850190610fd2565b50815167ffffffffffffffff811115610cf457610cf461139e565b604051908082528060200260200182016040528015610d1d578160200160208202803683370190505b508051610d34916004840191602090910190611028565b506002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0186905560405186917fe0a358d4a766346f1ece85d22e2197435d610d9638874a0fd6746e58a1b1f58a91a25050505050565b610da0610e11565b6001600160a01b038116610e055760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161032a565b610e0e81610f82565b50565b6000546001600160a01b03163314610a405760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161032a565b6001600160a01b03811660009081526001602052604090205460ff16158015610ea257506000546001600160a01b03828116911614155b15610e0e57604051636d3f049f60e01b81526001600160a01b038216600482015260240161032a565b6002546000805b82811015610f0e578360028281548110610eee57610eee611519565b906000526020600020015403610f0657809150610f0e565b600101610ed2565b506002610f1c600184611632565b81548110610f2c57610f2c611519565b906000526020600020015460028281548110610f4a57610f4a611519565b6000918252602090912001556002805480610f6757610f67611645565b60019003818190600052602060002001600090559055505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215611018579160200282015b82811115611018578251829061100890826116ab565b5091602001919060010190610ff2565b5061102492915061106f565b5090565b828054828255906000526020600020908101928215611063579160200282015b82811115611063578251825591602001919060010190611048565b5061102492915061108c565b8082111561102457600061108382826110a1565b5060010161106f565b5b80821115611024576000815560010161108d565b5080546110ad9061152f565b6000825580601f106110bd575050565b601f016020900490600052602060002090810190610e0e919061108c565b80356001600160a01b03811681146110f257600080fd5b919050565b6000806040838503121561110a57600080fd5b8235915061111a602084016110db565b90509250929050565b6000815180845260005b818110156111495760208185018101518683018201520161112d565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061117c6020830184611123565b9392505050565b60006020828403121561119557600080fd5b61117c826110db565b6000602082840312156111b057600080fd5b5035919050565b600080602083850312156111ca57600080fd5b823567ffffffffffffffff808211156111e257600080fd5b818501915085601f8301126111f657600080fd5b81358181111561120557600080fd5b8660208260051b850101111561121a57600080fd5b60209290920196919550909350505050565b60008060008060006080868803121561124457600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff8082111561127157600080fd5b818801915088601f83011261128557600080fd5b81358181111561129457600080fd5b8960208285010111156112a657600080fd5b9699959850939650602001949392505050565b60008151808452602080850194506020840160005b838110156112ea578151875295820195908201906001016112ce565b509495945050505050565b6000602080835260c08301845182850152818501516040850152604085015115156060850152606085015160a0608086015281815180845260e08701915060e08160051b8801019350848301925060005b818110156113745760df19888603018352611362858551611123565b94509285019291850191600101611346565b505050506080850151848203601f190160a0860152915061139581836112b9565b95945050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156113dd576113dd61139e565b604052919050565b600080600080608085870312156113fb57600080fd5b84359350602080860135935060408601359250606086013567ffffffffffffffff8082111561142957600080fd5b818801915088601f83011261143d57600080fd5b81358181111561144f5761144f61139e565b8060051b61145e8582016113b4565b918252838101850191858101908c84111561147857600080fd5b86860192505b83831015611508578235858111156114965760008081fd5b8601603f81018e136114a85760008081fd5b87810135868111156114bc576114bc61139e565b6114ce601f8201601f19168a016113b4565b8181528f60408385010111156114e45760008081fd5b81604084018b83013760009181018a0191909152835250918601919086019061147e565b999c989b5096995050505050505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061154357607f821691505b60208210810361156357634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b03861681528460208201528360408201526080606082015260006115c0608083018486611569565b979650505050505050565b6000602082840312156115dd57600080fd5b8151801515811461117c57600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610404576104046115ed565b60208152600061162a602083018486611569565b949350505050565b81810381811115610404576104046115ed565b634e487b7160e01b600052603160045260246000fd5b601f821115610705576000816000526020600020601f850160051c810160208610156116845750805b601f850160051c820191505b818110156116a357828155600101611690565b505050505050565b815167ffffffffffffffff8111156116c5576116c561139e565b6116d9816116d3845461152f565b8461165b565b602080601f83116001811461170e57600084156116f65750858301515b600019600386901b1c1916600185901b1785556116a3565b600085815260208120601f198616915b8281101561173d5788860151825594840194600190910190840161171e565b508582101561175b5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea26469706673582212203b7e19bebe712ce78978ebb6c3659a27988c10ef5b9291dc3be6171d775b5f6864736f6c634300081700330000000000000000000000001a49d2d1e739e3571e5dee004aef81fb4a67ba1e