-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
project_structure: | ||
build: build | ||
contracts: contracts | ||
interfaces: interfaces | ||
reports: reports | ||
scripts: scripts | ||
tests: tests | ||
|
||
networks: | ||
default: goerli-alchemy | ||
development: | ||
gas_limit: max | ||
gas_buffer: 1 | ||
gas_price: 0 | ||
max_fee: null | ||
priority_fee: null | ||
reverting_tx_gas_limit: max | ||
default_contract_owner: true | ||
cmd_settings: null | ||
live: | ||
gas_limit: auto | ||
gas_buffer: 1.1 | ||
gas_price: auto | ||
max_fee: null | ||
priority_fee: null | ||
reverting_tx_gas_limit: false | ||
default_contract_owner: false | ||
|
||
compiler: | ||
evm_version: null | ||
solc: | ||
version: null | ||
optimizer: | ||
enabled: true | ||
runs: 200 | ||
remappings: null | ||
vyper: | ||
version: null | ||
|
||
console: | ||
show_colors: true | ||
color_style: monokai | ||
auto_suggest: true | ||
completions: true | ||
editing_mode: emacs | ||
|
||
reports: | ||
exclude_paths: null | ||
exclude_contracts: null | ||
only_include_project: true | ||
|
||
hypothesis: | ||
deadline: null | ||
max_examples: 50 | ||
report_multiple_bugs: False | ||
stateful_step_count: 10 | ||
phases: | ||
explicit: true | ||
reuse: true | ||
generate: true | ||
target: true | ||
shrink: true | ||
|
||
autofetch_sources: false | ||
dependencies: null | ||
dev_deployment_artifacts: false | ||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity =0.8.7; | ||
|
||
contract Vote { | ||
|
||
event Voted(address indexed voter, uint8 proposal); | ||
|
||
mapping(address => bool) public voted; | ||
|
||
uint256 public endTime; | ||
|
||
uint256 public proposalA; | ||
uint256 public proposalB; | ||
uint256 public proposalC; | ||
|
||
constructor(uint256 _endTime) { | ||
endTime = _endTime; | ||
} | ||
|
||
function vote(uint8 _proposal) public { | ||
require(block.timestamp < endTime, "Vote expired."); | ||
require(_proposal >= 1 && _proposal <= 3, "Invalid proposal."); | ||
require(!voted[msg.sender], "Cannot vote again."); | ||
voted[msg.sender] = true; | ||
if (_proposal == 1) { | ||
proposalA ++; | ||
} | ||
else if (_proposal == 2) { | ||
proposalB ++; | ||
} | ||
else if (_proposal == 3) { | ||
proposalC ++; | ||
} | ||
emit Voted(msg.sender, _proposal); | ||
} | ||
|
||
function votes() public view returns (uint256) { | ||
return proposalA + proposalB + proposalC; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity =0.8.7; | ||
|
||
contract Vote { | ||
|
||
event Voted(address indexed voter, uint8 proposal); | ||
|
||
mapping(address => bool) public voted; | ||
|
||
uint256 public endTime; | ||
|
||
uint256 public proposalA; | ||
uint256 public proposalB; | ||
uint256 public proposalC; | ||
|
||
constructor(uint256 _endTime) { | ||
endTime = _endTime; | ||
} | ||
|
||
function vote(uint8 _proposal) public { | ||
require(block.timestamp < endTime, "Vote expired."); | ||
require(_proposal >= 1 && _proposal <= 3, "Invalid proposal."); | ||
require(!voted[msg.sender], "Cannot vote again."); | ||
voted[msg.sender] = true; | ||
if (_proposal == 1) { | ||
proposalA ++; | ||
} | ||
else if (_proposal == 2) { | ||
proposalB ++; | ||
} | ||
else if (_proposal == 3) { | ||
proposalC ++; | ||
} | ||
emit Voted(msg.sender, _proposal); | ||
} | ||
|
||
function votes() public view returns (uint256) { | ||
return proposalA + proposalB + proposalC; | ||
} | ||
} | ||
|
||
|
||
|
Binary file not shown.
Oops, something went wrong.