No funded issue found.
Check out the Issue Explorer
Be the OSS Funding you wish to see in the world.
Looking to fund some work? You can submit a new Funded Issue here .
Time left
Opened
Issue Type
Workers Auto Approve
Project Type
Time Commitment
Experience Level
Permissions
Accepted
Reserved For
Ocean Bounty: Smart Contract for Ocean DApp
oceanprotocol
ethereum, smart contract, solidity, truffle, javascript, web3.js, Kovan, Rinkegy, musicmap, oceanprotocol
# 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](https://material-ui.com/). 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.

## 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](https://github.com/oceanprotocol/musicmap/tree/master/specs/mechanics_part-iib.md).**
## What needs to be done?
### Logic & Mechanics (MOST IMP and MUST be implemented)
The following mechanics need to be implemented:
* All new tracks will enter a βsandbox registryβ with a score of zero.
* For each song, users can vote either vouch or reject, which - after confirmation - will be irrevocably stored (the vote is locked) as part of each user's account.
* Each track will display the current total number of votes (positive minus negative) = track rating.
* For every similar vote (vouch or reject) after theirs, the user will get that vote as a credit point, but there will be two user scores: one for vouch votes and one for reject votes.
* Each user will have a double total credit score, one for all vouch credit points and one for all reject credit points.
* The genre score divided by the number of tracks equals the average track score.
* Each user can have a maximum of 10 votes per day = UserDailyVoteCap.
* Once a song goes below the BlacklistThreshold (default = -100), it gets blacklisted and removed from the registry.
* Once a song goes above the WhitelistThreshold (default = +10), it will be placed in the whitelist (main) playlist.
* Proposers and users who voted vouch get a penalty of 5 x average score when their song gets rejected (blacklisted).
* Users who voted reject when the track gets whitelisted, get a penalty of the track rating minus WhitelistThreshold.
* Governance Parameters and Default Values:
WhitelistTreshold = 10
BlacklistThreshold = -100
UserDailyVoteCap = 10
PunishmentMultiplier = 5
### 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.
```javascript
/************** 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](https://github.com/oceanprotocol/musicmap/tree/master/specs/mechanics_part_i.md)
[Part IIb - Continuous Voting Model](https://github.com/oceanprotocol/musicmap/tree/master/specs/mechanics_part-iib.md)
[Part III - Conclusion & Rewards](https://github.com/oceanprotocol/musicmap/tree/master/specs/mechanics_part_iii.md)
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:
- [ ] All the mechanics are written in Solidity code (with latest compiler) using truffle.js framework.
- [ ] The smart contract can be deployed on an Ethereum testnet (rinkeby/ropsten)
- [ ] Gas costs are not important but excessive actions should be avoided.
- [ ] Tests are written and test coverage is above 80%
- [ ] The code is merged into the master branch of the repo in the 'contracts' folder.
- [ ] Write setup, deployment and usage instructions in README.md in 'contracts' folder
## 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](https://gitcoin.co/explorer?network=mainnet&keywords=oceanprotocol&order_by=-web3_created).
We'll be responding to your questions here, but for discussion and clarification we recommend to join also our [Gitter channel](https://gitter.im/oceanprotocol/Lobby) 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](https://metamask.zendesk.com/hc/en-us/articles/360015489011-Managing-ERC20-Tokens).
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.
Setup your profile
Tell us a little about you:
Skills
No results found for [[search]] .
Type to search skills..
Bio Required
[[totalcharacter]] / 240
Are you currently looking for work?
[[ option.string ]]
Next
Setup your profile
Our tools are based on the principles of earn (π°), learn (π), and meet (π¬).
Select the ones you are interested in. You can change it later in your settings.
I'm also an organization manager looking for a great community.
Back
Next
Save
Enable your organization profile
Gitcoin products can help grow community around your brand. Create your tribe, events, and incentivize your community with bounties. Announce new and upcoming events using townsquare. Find top-quality hackers and fund them to work with you on a grant.
These are the organizations you own. If you don't see your organization here please be sure that information is public on your GitHub profile. Gitcoin will sync this information for you.
Select the products you are interested in:
Out of the box you will receive Tribes Lite for your organization. Please provide us with a contact email:
Email
Back
Save