Code Monkey home page Code Monkey logo

government-sc's Introduction

Ethereum Smart Contracts in Solidity for DApp CITIZEN project

Presentation

DApp CITIZEN is a project to create a token economy and manage a fictional country and its citizens by deploying smart contracts on Ethereum blockchain written in Solidity :

Token.sol handles the token
Government.sol handles State Affairs.

  • contracts inherit from Open Zeppelin contracts ERC777 and Ownable already tested contracts and use SafeMath library
  • testing done using Mocha test framework, Chai assertion library and Open Zeppelin's Test Environment and Test Helpers
  • deployment via Truffle on Rinkeby Testnet
  • comments using NatSpec format which generate documentation via solidity-docgen

Install

Install dependencies:

% yarn install

Add environment variables:

Add .env file with 2 variables MNEMONIC and ENDPOINT_ID from Infura

Details of the project

token CITIZEN

A token called CITIZEN (symbol CTZ, 18 decimals) serves as national currency and citizenship point inside this country.
1 ETH == 100 CTZ.
100 CITIZEN are automatically awarded to any individual who wishes to become a citizen.

Sovereign

An entity called sovereign is the owner of the state, has the right to register and unregister companies and hospitals or to denaturalize citizens.
It is minted, during token contract deployment, 100% of the total supply (1 million CTZ) and retains the right to burn or mint tokens CTZ in the future in order to regulate the economy.

Companies

A company is identified by its Ethereum address and, in order to function, it must be first registered by the sovereign.
It can then buy CTZ from the sovereign.
A company can recruit employees among the registered citizens, pay them salaries in CTZ tokens and dismiss them.

Hospitals

A hospital is identified by its Ethereum address and, in order to function, it must be first registered by the sovereign.
A hospital can change the health status of a registered citizen between healthy and sick, or declare the death of a citizen.

The citizens

The citizens are identified by their Ethereum address and can have different properties:

  • alive / dead
  • healthy / sick
  • working / unemployed
  • an employer
  • a date when it's possible to ask for retirement etc.

A citizen has also a balance of CTZ spread between a current account, an unemployment insurance, a health insurance and a retirement insurance. Only the current account is at the citizen's disposal.

Life events :

  • A new citizen is awarded 100 CTZ which go into the current account.
  • The salary received from an employer is spread as follows: 10% for unemployment insurance, 10% for health insurance, 10% for retirement insurance and the remaining 70% into the current account.
  • On employer's dismissal all unemployment insurance tokens are transfered into the current account.
  • On being declared sick by a hospital all health insurance tokens are transfered into the current account.
  • At retirement (if above retirement age) all unemployment insurance and retirement insurance tokens are transferred into the current account.
  • On being declared dead by a hospital all tokens of the deceased are given back to the sovereign.

government-sc's People

Contributors

mihaidld avatar

Watchers

 avatar

Forkers

heng-xiu

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.