oceanprotocol-archive / bounties

🎣 Bounties for Ocean Protocol
Apache License 2.0
11 stars 0 forks source link

Ocean Bounty: Smart Contract for Ocean DApp #13

Closed Kwinten-C closed 3 years ago

Kwinten-C commented 5 years ago

Ocean Bounty : Smart Contract for Ocean DApp

We are working on a dApp using React (for frontend) and Express.js (for node.js server). We are using material UI theme for React. We need your help to write the Ethereum smart contract that defines the rules and permissions of the application. We prefer to use truffle framework for this. We already have some implementation of the app. See components diagram below.

mm-sketch_bounty2

How can you help?

Write a smart contract in Solidity that defines the incentives and rules for our musicmap app and that can be deployed on the Ethereum testnet (Kovan or Rinkeby). Our Dapp will eventually synchronize and perform operations on this smart contract using web3.js (but this web3.js integration is out-of-scope for this bounty. we will have seperate bounty for that later)

In this contract, the users of the network will need to be defined, as well as the entire incentive logic.

[Link to Github Repo] (https://github.com/oceanprotocol/musicmap)

It is highly recommended to read the full business logic before starting here.

What needs to be done?

Logic & Mechanics (MOST IMP and MUST be implemented)

The following mechanics need to be implemented:

Solidity Smart contract template for above mechanics

Note : This is just a sample and for your reference and understanding. We don't expect the final code to have exactly similar structure. Most important is that this contract behaves according to the game mechanics and logic defined above.


/************** variables **********************/
averageScore = genreScore/totalTracks      //this value gets updated with new entries of tracks or with every user action

mapping(hash => state) playlist;   // playlist mapping track hash to state {SANDBOX, WHITELIST}

/**************  constants ********************/
WhitelistThreshold = 10
BlacklistThreshold = -100

/**************** enums *****************/
Vote = {VOUCH, REJECT}
State ={ SANDBOX, WHITELIST}

/************* structs ***************/
struct tracks {
hash        //this is a hash of all metadata (stored offchain in mongodb for that track)(also acts as track id)  
score                                //sum total of positive and negative votes for this track
mapping(userId => Vote) userVotes            //total users who voted for this track and mapping of userId with Votes struct

}
struct users {
id                //public key of a user
vouchCredits             //total credits earned by user when vouched for a track
rejectCredits           //total credits earned by user when rejected a track
mapping (hash => Vote) votes         //tracks this user has voted on and mapping of track hash with user’s vote {VOUCH, REJECT}

}

/****** functions *********/
//this function vouches or rejects the given track based on user vote 
function VouchOrReject(trackHash, didVouch, userId){
    //check if user has not already voted for this track
        //update above mappings appropritely after calculating new state of the track in playlist and appropriate credits for this user and other users who voted for this track
    _checkForRejection()
    _distributeCredits(trackHash, didVouch, userId);
    _updateAverageScore()

}
//this function distributes credits appropriately based on game mechanics in above section
function _distributeCredits(trackHash, didVouch, userId) {
}
//this function updates average score of this genre with every user action
function _updateAverageScore(){}
//this function checks if given track qualifies to be removed based on Rejection score
function _checkForRejection(){}

More information and documentation

See the full description of the curation mechanics here (only part II b is really within scope of this bounty): Part I - Ingestion & General Part IIb - Continuous Voting Model Part III - Conclusion & Rewards

The PR should be created in the following repo: (new folder named "contracts" should be created) https://github.com/oceanprotocol/musicmap/tree/master/chain

We are happy when:

Seen this problem before?

Any help solving this is welcome. Feel free to leave any comments and help someone else to solve it. We might airdrop tokens to someone even if not directly completing bounty.

Questions & Reviews

Pull requests will be reviewed by one of the maintainers or long-term contributors. In case of any additional questions feel free to ask in this thread and we will do our best to add the missing info :)

Things to know

The bounty lifecycle process including payout will be managed using Gitcoin. We'll be responding to your questions here, but for discussion and clarification we recommend to join also our Gitter channel where our tech community is accessible. In order to see the PROCN balance in your wallet you'll need to reference the related token contract with address 0xf2aabdd898a0139195b2b5da7387d43a45ded254. If you use a Metamask plugin you'll find the the exact steps here. Lastly, even if it is a contest bounty, we will reward all valuable contributions and efforts. We greatly appreciate the value our open source community brings to Ocean and will always award some tokens to all great contributions! :smiley:

Reward

Once the project was reviewed and merged in the master branch, you will receive the reward. PROCN is a proto-Ocean token. Bounty hunters that earn PROCN will be able to convert them 1:1 to Ocean tokens on network launch (Ocean Token will be valued at at 0.22 EUR on network launch). Network launch is expected to happen by Mar 31, 2019. Until then PROCN will be locked and non-transferrable in the ETH wallet to which it is delivered to.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 2500.0 PROCN attached to it as part of the Ocean Protocol Foundation fund.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 4 weeks from now. Please review their action plans below:

1) thegooner93 has applied to start work _(Funders only: approve worker | reject worker)_.

My experience comprises of writing a Solidity based Smart contract for a simple voting DApp, and have gone through walkthroughs for implementing the Cryptozombies game by Loom Network. I will use the skeleton contract provided to implement the required features.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 years, 10 months ago. Please review their action plans below:

1) thegooner93 has been approved to start work.

My experience comprises of writing a Solidity based Smart contract for a simple voting DApp, and have gone through walkthroughs for implementing the Cryptozombies game by Loom Network. I will use the skeleton contract provided to implement the required features. 2) christopher-i has been approved to start work.

I will write a smart contract in solidity implementing all the described governance protocols and mechanics, next I will run tests using the latest solidity compiler and truffle release. I currently have a working test environment set up and I will make necessary adjustments to ensure a test coverage of over 80%. I will ensure that the code is lean and performs on minimal cost to its users. I will create a README file in the contracts folder to explain clearly all features of the smart contract and its usage. I will deploy the contract to the rinkeby network and run final tests to ensure the smart contract functions as expected

Learn more on the Gitcoin Issue Details page.

dev1644 commented 5 years ago

Can other people participate in it?

innopreneur commented 5 years ago

@dev1644 yes others can also participate. Its in contest mode, so it accepts multiple submissions. If interested, go to Gitcoin and apply for this bounty. Cheers

innopreneur commented 5 years ago

Hi @thegooner93, thanks for applying to work on this bounty. Have you already started working on it? Do you have any questions regarding this bounty?

TheGooner93 commented 5 years ago

@innopreuner yes, no questions as if now. I will keep you posted 😁

innopreneur commented 5 years ago

@TheGooner93 great. In case of any questions, you can reach me and others more efficiently at our gitter channel.

TheGooner93 commented 5 years ago

hi @innoprenuer question from my side- Would the contract being created be specific to a single music genre?

Kwinten-C commented 5 years ago

Hi @TheGooner93 : The contract deals with one playlist which is tied to a single music genre. For a subsequent release (not in the current scope), multiple contracts will be spinned up for each playlist/genre. So that is something to keep in mind.

Kwinten-C commented 5 years ago

@TheGooner93 If you have more questions, you can also reach us at Gitter: https://gitter.im/oceanprotocol/Lobby. You can ping us for private or mote detailed questions.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 2500.0 PROCN has been submitted by:

  1. @thegooner93
  2. @christopher-i

@chalidbdb please take a look at the submitted work:


gitcoinbot commented 5 years ago

⚡️ A tip worth 1000.00000 PROCN has been granted to @thegooner93 for this issue from @chalidbdb. ⚡️

Nice work @thegooner93! Your tip has automatically been deposited in the ETH address we have on file.

gitcoinbot commented 5 years ago

⚡️ A tip worth 500.00000 PROCN has been granted to @christopher-i for this issue from @chalidbdb. ⚡️

Nice work @christopher-i! Your tip has automatically been deposited in the ETH address we have on file.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This Bounty has been completed.

Additional Tips for this Bounty:


Christopher-I commented 5 years ago

could you please mark this project as done on gitcoin?