GithubHelp home page GithubHelp logo

isabella232 / kyber-pool-master-proxy-contract Goto Github PK

View Code? Open in Web Editor NEW

This project forked from protofire/kyber-pool-master-proxy-contract

0.0 0.0 0.0 2.67 MB

KyberDAO - Smart Contract Proxy For Pool Masters

License: MIT License

Shell 0.37% JavaScript 68.76% Solidity 30.87%

kyber-pool-master-proxy-contract's Introduction

License: MIT Coverage Status CI

Kyber PoolMaster proxy contract

Contract that allows pool masters to let pool members claim their designated rewards trustlessly and update fees with sufficient notice times while maintaining full trustlessness.

For pool operators who prefer a trustless mechanism for reward distribution, they can choose to deploy this smart contract, that will store the rewards in the proxy contract and allow their pool members to claim the rewards directly from the proxy contract.

Motivation

The current KyberDao delegation model allows for non-custodial delegation of KNC, but requires pool masters to have a mechanism for storing, tracking and distributing the rewards for members.

Functionality

  • Store the rewards trustlessly in the smart contract
  • Allow the users to claim their rewards from the smart contracts
  • Track the rewards that have been claimed by the users

Audit

Find v1.0.0 audits results here

How it works

  • If you deploy this smart contract, KNC holders can delegate their KNC voting power to the contract where you act as pool operator.
  • You can vote on behalf of pool members, but you will have no control over their KNC or ETH rewards.
  • After you vote, the subsequent ETH rewards are stored trustlessly in the smart contract and pool members can claim it themselves anytime.
  • Rewards can be tracked on-chain.

About Delegation Fee

Commit new fee

This sets a new delegation fee to be applied in a future epoch, lengthening the notice given to Pool members on any fee changes on the PoolMaster Contract to epochNotice epochs. The fee change notice is a public state variable epochNotice that can be configured on init, so that poolMasters have more flexibility.

  • Only 1 pending fee at any given time
  • If at the moment of committing a new fee there is a delegation fee pending to be applied:
    • The pending fee still not able to applied, due to deadline not reached, the new fee will replace the pending one as the new pending, renewing its deadline as well
    • The pending fee can be applied then mark as applied and add the new one as pending. Emit NewFees event
  • Emit CommitedNewFee event

Apply Fee

This is used for noticing that a new fee has been applied.

  • Only mark a fee as applied if current epoch is greater or equal to fromEpoch
  • Mark a fee as applied when a new one is committed an the pending one can be applied
  • Mark a fee as applied when claiming reward for an epoch which needs to use the pending fee

Deployment

  1. Create a configs.json file using configs.json.example and set:
  • INFURA_PROJECT_ID your Infura project id
  • DEPLOYMENT_ACCOUNT_PK your deploying address private key
  • GAS_PRICE gas price to be used, denominated in wei
  • KYBER_DAO_ADDRESS KyberDao address
  • KYBER_FEE_HANDLERS_ADDRESS [KyberFeeHandlers addresses]
  • REWARD_TOKENS [address], ERC20 token address each FeeHandler transfers on reward claim, or 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH
  • EPOCH_NOTICE Delegation fee change notice. Integer parameter, for example EPOCH_NOTICE=2, then on the epoch #10 if you change the delegation fee (commitNewFee), that new fee starts on epoch #12
  • INITIAL_DELEGATION_FEE Initial delegation fee, denominated in 1e4 units - 100 = 1%

In order to support the plan of KyberDAO of having miltiple FeeHandlers KYBER_FEE_HANDLERS_ADDRESS and REWARD_TOKENS should be arrays with the same size. So REWARD_TOKENS[k] will be set as the reward token for KYBER_FEE_HANDLERS_ADDRESS[k].

  1. Install dependencies
$ npm install
  1. Run deployment script, where NETWORK is ropsten or mainnet
$ npm run deploy:NETWORK

APIs

PoolMaster contract APIs

Resources

Develop

Install Dependencies

npm install

Test

npm test

Run coverage tests

npm run coverage

Flatten

Fattened contracts can be used to verify the contract code in a block explorer like BlockScout or Etherscan. The following command will prepare flattened version of the contract:

npm run flatten

The flattened contracts can be found in the flats directory.

Help and Support

Please do not hesitate to reach out to us through http://protofire.io

License

This project is licensed under the MIT License. See the LICENSE file for details.

kyber-pool-master-proxy-contract's People

Contributors

bneiluj avatar cmalfesi avatar lmcorbalan avatar mgarciap avatar patitonar 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.