Parietal / rewarder-smart-contracts

Code arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smart contracts for Mysterium Network bounty rewards

This is a set of smart contracts which allow Mysterium team securelly pay exit node bounty and affiliate program rewards. Users who gets rewards will be able to claim them at any time. If they decide not to claim righ after rewards are calculated (e.g. once in a week) then next time they will claim accumulated rewards for both periods at once.

This approach also allows to reduce blockchain transaction fees for both Mysterium team and users while giving bigger flexibility (e.g. possibility to do payouts each weeek instead of once in a month). This

This is also more trustless way for reward distribution (and more similar to how it will work on MainNet). Once rewards are distributed (added new merkle root into blockchain), team can't take them back, even if user is not claiming them for very long time.

There are two main smart contracts:

  • Custody.sol which holds bigger amount of tokens which will be used in future payouts.
  • Rewarder.sol holds main payout and rewards claiming logic. Each time during reward distribution there will be sent new merkle tree root and users will get merkle proofs (via off-chain channels, e.g. in node or affiliate dashboards) which allows to claim rewards.

Setup and test

We're using truffle for smart contract compilation and running tests.

  1. Install dependencies
npm install
  1. Run tests
npm test
  1. Testing deployment (into Görli testnet)

First you should add own mnemonic into hardhat.config.js from which ethereum accounts and private keys will be created. Then simply run:

npx hardhat run --network goerli scripts/deploy.js

Current deployment (ethereum Görli testnet)

Goerli

Matic mainnet

Current

Old

Topperupper (deprecated)

About

Code arrays


Languages

Language:JavaScript 59.2%Language:Solidity 30.5%Language:Go 9.9%Language:Dockerfile 0.4%