diff --git a/DAO_SMART_CONTRACT/Medium_DAO_contract.sol b/DAO_SMART_CONTRACT/Medium_DAO_contract.sol new file mode 100644 index 0000000..6e7f1ea --- /dev/null +++ b/DAO_SMART_CONTRACT/Medium_DAO_contract.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract DAO { + // Events + event Log(bytes mesg, address newJoinee); // For emitting message and new joined member + event Voted(address voter, string question, bool vote); // For emitting message when a member votes + + // Variables + address[] public members; // This will contain all the members in the DAO + mapping(address => bool) public isMember; // This will contain the boolean value whether the member exists or not + string[] public questions; + mapping(string => mapping(address => bool)) public didVoted; + mapping(string => uint) public yesVotes; + mapping(string => uint) public noVotes; + + // Modifiers + modifier onlyMembers() { + require(isMember[msg.sender] == true); + _; + } + + // Function to enter DAO + function joinDAO() public { + members.push(msg.sender); + isMember[msg.sender] = true; + emit Log("New member joined", msg.sender); + } + + // Function for creating voting questions + function createVotingQuestion(string memory _question) public onlyMembers { + questions.push(_question); + yesVotes[_question] = 0; + noVotes[_question] = 0; + } + + // Function for voting on questions + function vote(string memory _question, bool _vote) public onlyMembers { + require(didVoted[_question][msg.sender] == false, "You have already voted on this question."); + didVoted[_question][msg.sender] = true; + if (_vote == true) { + yesVotes[_question] += 1; + } else { + noVotes[_question] += 1; + } + emit Voted(msg.sender, _question, _vote); + } +} diff --git a/DAO_SMART_CONTRACT/README.md b/DAO_SMART_CONTRACT/README.md new file mode 100644 index 0000000..67fff9b --- /dev/null +++ b/DAO_SMART_CONTRACT/README.md @@ -0,0 +1,20 @@ +📝 # Smart Contract for DAO + +## Aim +The aim of this DAO contract is to create a simple logic for membership, creating questions and voting on questions. + +This DAO logic is divided into three levels. + +- **Simple**: for showing the most basic version of DAO with voting and creating questions. +- **Medium**: for extending the contract for voting on questions. +- **Hard**: for general public to contribute to the DAO functionality. + +## Levels + +- **Simple**: [:link:](https://github.com/PriyathamVarma/The-Quest/blob/main/DAO_SMART_CONTRACT/simple_dao_contract.sol) +- **Medium**: [:link:](https://github.com/PriyathamVarma/The-Quest/blob/main/DAO_SMART_CONTRACT/Medium_DAO_contract.sol) +- **Hard**: + +**Want to Contribute ?** : [Click here for instructions](https://github.com/PriyathamVarma/The-Quest/blob/main/DAO_SMART_CONTRACT/how_to_contribute.md) + +Tags: #smartcontract #DAO #voting #ethereum #blockchain diff --git a/DAO_SMART_CONTRACT/how_to_contribute.md b/DAO_SMART_CONTRACT/how_to_contribute.md new file mode 100644 index 0000000..5b57002 --- /dev/null +++ b/DAO_SMART_CONTRACT/how_to_contribute.md @@ -0,0 +1,27 @@ +# Contributing to the DAO Smart Contract (Hard Level) + +Thank you for your interest in wanting to contribute to the hard level of the DAO smart contract! This level is intended for those who have experience with Ethereum smart contract development and are interested in building additional functionality for the contract. + +The **main objective** is to create a functionality for the DAO where memebers who staked their tokens can only vote. + +To get started, please follow the steps below: + +## Step 1: Fork the Repository + +To contribute to the DAO smart contract, you will need to fork the repository to your own GitHub account. This will allow you to make changes to the code and submit pull requests to merge your changes back into the main repository. + +## Step 2: Set Up the Development Environment + +To develop and test the smart contract, setup the contract in Remix IDE. + +## Step 3: Build and deploy Your Changes + +Once you have set up your development environment, deploy the contract to testnet or to the local environment. + +## Step 5: Submit a Pull Request + +After you have done your changes and are satisfied with them, you can submit a pull request to merge your changes back into the main repository. Please make sure to describe your changes in the pull request and provide any relevant documentation. + +## Conclusion + +I welcome any contributions to the DAO smart contract and appreciate your efforts to make it better. If you have any questions or need help getting started, please don't hesitate to reach out to us! diff --git a/DAO_SMART_CONTRACT/simple_dao_contract.sol b/DAO_SMART_CONTRACT/simple_dao_contract.sol new file mode 100644 index 0000000..cda5dab --- /dev/null +++ b/DAO_SMART_CONTRACT/simple_dao_contract.sol @@ -0,0 +1,44 @@ +// A simple DAO contract to join and create a simple question + +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract DAO{ + // Events + event Log(bytes mesg,address newJoinee);// For emitting message and new Joined memeber + + // Variables + address[] public members; // This will contain all the memebers in the DAO + mapping(address => bool) public isMember; // This will contain the boolean value whether the member exists or not + string[] public questions; + mapping(string => mapping(address => bool)) public didVoted; + + // Modifiers + modifier onlyMembers(){ + + require(isMember[msg.sender] == true); + _; + + } + + // Function to enter DAO + function joinDAO() + public{ + members.push(msg.sender); + isMember[msg.sender] = true; + emit Log("New member joined",msg.sender); + } + + // Function for creating voting questions + function createVotingQuestion(string memory _question) + public + onlyMembers{ + + questions.push(_question); + + } + + + + +} diff --git a/README.md b/README.md index 2089dd1..de88280 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,3 @@ +# The Quest - Solutions -# The Quest - -![42 (1)](https://user-images.githubusercontent.com/128218414/236816131-6743e2b1-8cb8-47ef-b198-e65cd5f773ab.png) - -Join the Quest challenge Exclusive for Polygon Advocates to showcase their skills and win amazing rewards like swags, a demo night with our head of growth, a sponsored trip up to $1000 to Polygon Connect, and a closed session with your chosen co-founder of Polygon Labs - - - -## goku#001 - goku#050 🔥 - -**How get one of these, What is the possible ways of contribution ?** - -Use Polygon solutions like POS, zkEVM, and ID to add a repo to the Advocates GitHub the challenge and submit your code to the repo this could be like Build a smart contract deployment or a basic dApp and show off your expertise to the Web3 community. - -**Ways to contribute and collect one of these:** - -- Create a repository showcasing your expertise by building a simple smart contract or dApp using Polygon solutions like POS, zkEVM, or ID. -- The smart contract could be a basic voting or polling system, crowdfunding platform, or any other contract of your choice. -- You could create a simple login system that uses Polygon's ID. - -These are some of the suggestion to what you could do, feel free to add your creative minds here, Also please make sure to submit your code to the Advocates GitHub, If you are having any difficulties creating one please contact Abix tg "**amiabix**". - -## naruto#001 - naruto#050 🍥 - -**How get one of these, What is the possible ways of contribution ?** - -To complete this challenge, You are required to host a workshop that focuses on building on the Polygon solutions like POS, zkEVM, and ID. The workshop can be conducted either online or offline, depending on the Advocate's preference and the feasibility of the location. - -**Ways to contribute and collect one of these:** - - - Facilitate the workshop on Polygon solutions like POS, zkEVM, and ID, providing guidance and support to - participants as needed, and encourage questions and discussion. - -## mikasa#001 - mikasa#050 🗡️ - -**How get one of these, What is the possible ways of contribution ?** - -To complete this challenge, You need to explore and experiment with different Polygon network tools and create tutorials and guides for other advocates to follow and something that could be used by others in the community to follow through. - -**Ways to contribute and collect one of these:** - - - Create tutorials and guides to help others to follow your steps and learn from your - experience. Your tutorials and guides could be in the form of blog, twitter thread - , video tutorials, or GitHub repositories. - -## itadori#001 - itadori#050 💪 - -**How get one of these, What is the possible ways of contribution ?** - -Participate in hackathons and events, showcasing your projects and sharing your experience with others, one of the recent hackathons running is [Polygon APAC DevX Tour](https://dorahacks.io/hackathon/polygondevx) feel free to build and showcase your skills and also get some bounties. - -## kagome#001 - kagome#200 🏹 - -**How get one of these, What is the possible ways of contribution ?** - -you can contribute in various non-technical ways as well. For instance, you can share your thoughts and ideas about the Polygon ecosystem by writing blog articles or creating visually appealing posters and memes. - -**Ways to contribute and collect one of these:** - - - You can create Twitter threads and share your experiences with - the community. Additionally, Things like a short videos to showcase - your Advocate journey or to provide insights into the benefits of - using Polygon solutions like POS, zkEVM, and ID. - - - There is a lot of flexibility when it comes to this contributions, - and you can explore different mediums to showcase your creativity and - get yourself this. - - -## What's in for the rewards 🌟 - -| Collections 🃏 | What it Unlocks 🔓 | -|--|--| -| 3 cards | Polygon Swag pack (ahm, could be anything tee, domains or idk) | -| 5 cards | Demo night for your product or bring in friend product to pitch to Head of Growth, Polygon | -|7 cards | Membership for Dev DAO and other tools like GitHub co-pilot etc.| -| 9 cards | Sponsored trip to Polygon Connect (upto $1000) | -|11 cards | Closed session with your chosen Co-founder of Polygon Labs | - -## Wait !! did we mention about Kuraia, the Nine-Tailed Vixen ? ✨ 🦊 ✨ - - -*Consider this as an exclusive card for doning anything out of the box, what could be something out of the box ? It could be anything that blows our heads through the roof with creativity, ***This is the Card eligible for all the rewards mentioned above and much more !!!**** - -## Submissions and guidelines 🏄‍♂️ - -1. Submit your work to the designated form [here](https://airtable.com/shrJW5zrv1BnZTxWy), Make sure to include a brief description of your work, your GitHub repository link (if applicable), and any other relevant details. - -2. The submission ***deadline for each challenge is May 30th***. Make sure to submit your work before the deadline to be eligible for rewards. - -3. All submissions will be reviewed by the Polygon team - -***looking to view the collection set ? [Check it out here](https://opensea.io/collection/the-quest-polygon-advocates)*** - - -## Is there a smart way of doing it ? 🧠 - -Yeah, Absolutely, let me drop you an example that helps you get 3 cards in a single go could be of help: - - - Create a repository showcasing your expertise by building a simple smart contract or dApp using Polygon solutions like POS, zkEVM, or ID on the Advocates GitHub, which gets you to complete the goku card. - - - Refine the repo with a good formatted # READMEs and publish, This could also include sections like, how people could contribute to it, Possible enhancements etc, which gets you to complete the mikasa card - - - Since you already have things in order just tweet about it in a formt of a twitter thread, tagging @0xPolyAdvocates ,Thread could have info about the repo, what one can learn from it or what did you contribute to it etc. which gets you to complete the Kagome card. - -***If you round that up you just unlocked the 3 card set for yourself in a single go !*** 🤩 🤩 - -That being said you could look for possible combinations to unlock others! Once done You could just add the detials for **submission** [**here**](https://airtable.com/shrJW5zrv1BnZTxWy) - +This repository is for submitting solutions to the polygon **THE QUEST** contest and claim rewards.