Skip to content

naszam/ants-review

Repository files navigation

#ubuntu 18.04 #npm 12.16.3 #built_with_Truffle built-with openzeppelin #solc v0.6.12 #testnet kovan #testnet rinkeby

ETH Turin 2020 DOI

Ants-Review

A Protocol for Open Anonymous Scientific Peer-Reviews on Ethereum
🥇 1st Place at ETHTurin Hackathon

The Project implements a Bounty-like protocol called Ants-Review to allow issuers to issue an AntReview, a bounty for peer-review in scientific publication, linked to requirements stored on ipfs which peer-reviewers can fufill by submitting the ipfs hash which contains evidence of their fufillment.
After the submission of successful peer-reviews, they will be approved by an approver and payed in ANTS.

Project (MVP) feautures:

  • ERC20 token, name: Ants-Review, symbol: ANTS.
  • ANTS Faucet on Kovan.
  • IPFS Hash Timestamped on Ethereum via PoE (Proof of Existence).
  • Storing on IPFS.
  • UI Deployed on IPFS via Fleek.

Future integrations & features:

  • OpenGSN for Meta Transactions.
  • zkANTS, allowing private ANTS transactions on Ethereum using ZK-SNARKs via AZTEC Protocol.
  • De-Fi services like Dai, Chai, MakerDAO DSR, ...
  • ENS, allowing human-readable Ethereum addresses
  • Quadratic Funding Gitcoin-like for Ants-Review.
  • Upgradability, to allow the logic to be extended and improved.
  • ...

Demo MVP

Mentors

White Paper
Presentation
Demo (PoC)
Pich Deck
FDAPP 2020

Sections

Building Blocks

Smart Contracts Flow-Chart

AntsReview a bounty-like system for scientific peer-reviews rewarded in ANTS

AntReview implements a bounty for scientific peer-reviews called AntReview where there are several key types of users:

  • AntReview Issuers are addresses, added by the owner of the contract, that can issue an AntReview via the function issueAntReview().
  • AntReview Approvers are addresses added by Issuers when they issue an AntReview or with the function addApprover().
  • AntReview Contributors are any address which has made a contribution of ANTS to a given AntReview.
  • AntReview Peer-Reviewers are addresses, added by the owner of the contract, that can fulfill an AntReview via the function fulfillAntReview().
  • AntReview Submitters are peer-reviers that submit a peer-review that can update their review via the function updateReview().

There are several core actions in the lifecycle of an AntReview, which can be performed by certain users:

  • issueAntReview() called by any Issuers to issu an AntReview, specifying the paper and requirements IPFS hash as well as issuers, approver and the deadline.
  • changeAntReview() called by any Issuers specified in an AntReview that can update the details of the AntReview.
  • addApprover() called by any issuers specified in an AntReview that can add an Approver.
  • removeApprover() called by any issuers specified in an AntReview that can remove an Approver.
  • contribute() called by any address that can send some ANTS to the AntReview of interest.
  • refund() called by any Contributors that can get a refund once the deadline is elapsed with no peer-reviews accepted.
  • fulfillAntReview() called by any Peer-Reviewer that can fulfill an AntReview, specyfing the IPFS hash of the peer-review.
  • updateAntReview() called by any Submitters to update a specific Peer-Review, by specifying the new IPFS hash of the updated peer-review.
  • acceptAntReview() called by any Approver to accept a peer-review for a specific AntReview and paying an amount of ANTS as reward.
  • withdrawReview() called by any issuers specified in an AntReview that can withdraw an amount from the AntReview once the deadline is elapsed to get the residual balance.

AntsReviewRoles Access Management for Default Admin, Issuer, Peer-Reviewer and Pauser Role

AntsReviewRoles inherits AccessControl module by OpenZeppelin, allowing the owner of the contract to be set as Default Admin and Pauser and to add Issuers and Peer-Reviewers via addIssuer() and addPeerReviewer() and to remove these roles via removeIssuer(), removePeerReviewer() functions.

ANTS Ants-Review's native token

ANTS is the ERC20 token used by the Ants-Review Protocol.
It allows the owner of the contract, set as Default Admin, Minter and Pauser to add and remove a Minter via addMinter(), removeMinter() functions. The minter is able create new ANTS tokens via mint() and the holder to burn them via the burn() function.

During deployment the contract sets the following ERC20 metadata:

  • name: "Ants-Review"
  • symbol: "ANTS"

AntsFaucet ANTS Faucet

AntsFaucet implements an ANTS Faucet to be used on Kovan to test the Ants-Review Protocol.
Anyone can get 10 ANTS by calling the withdraw() function.

Setup

Clone this GitHub repository.

Steps to compile and deploy

  • Local dependencies:
    • Truffle
    • Ganache CLI
    • OpenZeppelin Library v3.0
    • Truffle HD Wallet Provider
    • Truffle Flattener
    $ npm i
  • Global dependencies:
    • Truffle (recommended):
    npm install -g truffle
    
    • Ganache CLI (recommended):
    npm install -g ganache-cli
    
    • Slither (optional):
    $ git clone https://github.com/crytic/slither.git && cd slither
    $ sudo python3 setup.py install
    • MythX CLI (optional):
    $ git clone git://github.com/dmuhs/mythx-cli
    $ sudo python setup.py install

Running the project with local test network (ganache-cli)

  • Start ganache-cli with the following command (global dependency):
    $ ganache-cli
  • Compile the smart contract using Truffle with the following command (global dependency):
    $ truffle compile
  • Deploy the smart contracts using Truffle & Ganache with the following command (global dependency):
    $ truffle migrate
  • Test the smart contracts using Mocha & OpenZeppelin Test Environment with the following command:
    $ npm test
  • Analyze the smart contracts using Slither with the following command (optional):
    $ slither .
  • Analyze the smart contracts using MythX CLI with the following command (optional):
    $ mythx analyze    

Deploy

Deploying on Kovan's Testnet

  • Get an Ethereum Account on Metamask.
  • On the landing page, click “Get Chrome Extension.”
  • Create a .secret file cointaining the menomic.
  • Get some test ether from a Kovan's faucet.
  • Signup Infura.
  • Create new project.
  • Copy the kovan URL into truffle-config.js.
  • Uncomment the following lines in truffle-config.js:
    // const HDWalletProvider = require("@truffle/hdwallet-provider");
    // const infuraKey = '...';
    // const infuraURL = 'https://rinkeby.infura.io/...';
    
    // const fs = require('fs');
    // const mnemonic = fs.readFileSync(".secret").toString().trim();
    
  • Install Truffle HD Wallet Provider:
    $ npm install @truffle/hdwallet-provider
  • Deploy the smart contract using Truffle & Infura with the following command:
    $ truffle migrate --network kovan

Project (PoC) deployed on Rinkeby

AntsReview.sol

Project (MVP) deployed on Kovan

AntsReview.sol
ANTS.sol
AntsFaucet.sol

Using the DApp

  • Install Ganache GUI.
  • Change Ganache GUI port to 8545.
  • Import Ganache GUI mnemonic into MetaMask.
  • Connect MetaMask to Ganache GUI, adding a custom RPC specifing the Ganache GUI's RPC server URL.
  • Deploy the smart contracts to Ganache GUI:
    $ truffle migrate
  • Move to client directory on the project:
    $ cd client
  • Install dependencies:
    $ yarn install
  • Start the Local Web Server:
    $ npm run start

Front-end

Interacting with the PoC:

  • The User (Author) can issue a new AntReview, specifying:
    • IPFS Hash of requirements (e.g. QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4);
    • Timestamp of the deadline (timestamp generator);
    • Ether value of the AntReview reward (e.g. 1 ETH);
  • Switch Account on MetaMask (Peer-Reviewer) and Refresh the DApp.
  • Fulfill the AntReview by specifying the AntReview Id and the IPFS Hash of the peer-review.
  • Switch Account on MetaMask to the Issuer (Author) and Refresh the DApp.
  • Accept the Fulfillment (Peer-Review) by specifying the AntReview Id and Peer-Review Id.
  • The Peer-Reviewer Account will get the reward for the AntReview.
  • Switch Account on MetaMask to the Issuer (Author) and Refresh the DApp.
  • Cancel AntReview by specifying the AntReview Id (to be used after the deadline, if the AntReview has not received any fulfillments)
  • The Issuer will get back the reward of the AntReview Id specified.
  • Done.

About

Inspiration & References

Awesome AntsReview

Authors

Project created by Team MetaBounty for ETHTurin 2020 Hackathon.
Research, Design by Bianca Trovò
Smart Contracts and Architecture by Nazzareno Massari
UI/UX by Mitrasish Mukherjee
Pixel Art by Marcelo Colmenero