Skip to content

Instantly share code, notes, and snippets.

@edisinovcic
Created November 10, 2021 11:19
Show Gist options
  • Select an option

  • Save edisinovcic/ebf7408005df0b6eea9ebf99abb7cde4 to your computer and use it in GitHub Desktop.

Select an option

Save edisinovcic/ebf7408005df0b6eea9ebf99abb7cde4 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: GPL-3.0
/*
* https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/governance
*/
pragma solidity >=0.7.0 <0.9.0;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/c9bdb1f0ae168e00a942270f2b85d6a7d3293550/contracts/token/ERC20/ERC20.sol";
/**
* @title DrinksDAO
* @dev If we create a token and give each of the participants equal amount and give them 2 options.
* 1) Wine
* 2) Beer
* And the ability to separate tokens into one or the other according to how much they want to drink one or the other.
* So each of the people will get 100 tokens they can separate at 1 or 2 as they wish. And at the certain point we will
* get the snapshot of the state to see where is the most of the vote and decide that way. What are the edge cases?
* Do we have an option to reclaim the tokens from each of those and give them to the other side of the beer/wine option?
* Are there any vectors of attack?
*/
contract DrinksDAO {
struct Proposal {
uint wine;
uint beer;
}
mapping(address => Proposal) public drinksDAOProposal;
Proposal private proposal;
mapping(address => bool) public didVote;
constructor() {
}
function vote(uint256 wine, uint256 beer) public {
}
function result() public view returns(uint, uint) {
}
// Improvments
// function reclaimVote() {}
// How to limit people from interacting with the contract multiple times?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment