Giter VIP home page Giter VIP logo

answer-to-earn's Introduction

Answer-To-Earn

Toy backend of abstractive Answer-To-Earn dApp for placing, answering to and accepting of answers to a various questions

Overview

I came across a simple idea to code an application, which gives opportunity to earn some money by sharing a knowledge. There are many related projects, such as Quora as an example, where experts sharing expertise in different domains in a form of answering questions. AFAIK non of them rewarding experts financialy and this simple project implements an answer-to-earn mechanic to battle this unfairity. Project were written for educational purposes and can only be treated in the same way.

Specifics

This is a modified version of an idea, described in How To Build a Blockchain Gaming DApp | (Chainlink Engineering Tutorials) with the following changes:

  • Supplement procedures (testing, deployment, etc) moved from foundry to brownie, for all the Python folks out there;
  • General mechanic is extended, such that funding and rewarding made in custom ERC20 token called QuestionToken, where the one who placed a question can approve or accept someone answer for funds to be sent. Question itself, funding and accepting action has designed in respective smart-contract. Proceeding answers stored off-chain in mind (out of scope of this project), to not wasting gas as it many answers could be given. After completion accepted answer stored on-chain and question marked as inactive;
  • Testing is also extended to cover all the logic with different cases

Building and testing

conda env create -f environment.yml
conda activate eth-brownie
pipx install eth-brownie
brownie test . --network development  # tests will pass

More realistic testing should be done on target network, so we can use Polygon mainnet fork (Alchemy API key required) by,

brownie networks add development polygon-main-fork-dev cmd=ganache-cli host=http://127.0.0.1 chain_id=137 fork='https://polygon-mainnet.g.alchemy.com/v2/<your-alchemy-api-key>' accounts=10 mnemonic=brownie port=8545
brownie test . --network polygon-main-fork-dev  # tests will pass

Deploying on-chain, testnet

I'm using Polygon (Mumbai) for playing on live network, and Alchemy as a node provider here. Before running the script make sure you have some MATIC, to get them you can use this faucet.

export PRIVATE_KEY=<your-wallet-private-key>
brownie networks add Polygon alchemy_mumbai host='<your-app-view-key-https>' name='Mumbai (Alchemy)' chainid=80001 explorer='<mumbai-explorer-address>'
brownie run scripts/mumbai_deploy.py --networks alchemy_mumbai

And, frontend?

Focusing on smart-contract development here, feel free to fork and design one.

TODO

  • Rewrite this project as a Program for Solana

answer-to-earn's People

Contributors

eatsleepraverepeat avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.