Git Product home page Git Product logo

contracts-gray's Introduction

Smart-contracts

Smart Contracts for the Grayblock Swap - The first yield farm backed by clean energy.

Branches :

  • main - A branch with V1 of smart contract for IDO,staking, Project Token

  • mobiloitte - A branch with smart contracts for tGVS (test Project token) , tUSD and IDO contract along with their tests

  • Staking - A branch with smart contracts for energy yield farming

The staking smart contract works in the following way:

staking contract is that we would preload the contract with say 10k BUSD (say 2 months worth yield) Lets take an example to understand the requirements, lets say A and B put in 100 project tokens each into the staking contract (so the total project tokens in the staking contract is 200). now every 6hrs we will execute a smart contract call setting the amount of busd that can be allocated to the stakers. so lets say the energy generated by the solar farm for that 6hr period is 100$ ( This means that every hour a and b can see their realtime yield via the dapp (which is fetched from the backend / smart meter feeds) BUT THEY CAN ONLY CLAIM IT EVRY 6HRS ) so then the smart contract will increase the allowance of each staker by a fraction of this 100$ in proportion to the fraction of the pool they contribute it to. So in this instance since both A and B have 50 50 % stake, the 50BUSD will be added to the allowance of each user (totalling to 100 busd) Now C joins in and adds another 800 tokens to the staking pool, so now A , B and C have their % staked as 10% 10% 80%, So now for the next 6 hour, lets say that the solar farm generates another 100$ So this time, A and B gets only 10BUSD accumulated and C gets 80BUSD accumulation. (this data about the solar farm yield will be read by a backend server that essentially does the smart contract calls so this updateAllowance function of the staking contract needs to be restricted to "backendOnly" modifier, backend server address can be taken in the constructor). The users can withdraw the accumulated rewards anytime. ( the rewards should be a public mapping ) The users start accumulating rewards (Ie get a share of the yield ) only 24 hrs after they start to stake (for security purposes)

For more detailed information see https://grayblock.github.io/Docs/#/smartcontracts

contracts-gray's People

Contributors

mxnre avatar

Watchers

 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.