Ethereum Smart Contracts in Solidity for DApp CITIZEN project – 以太坊智能合约在DApp市民项目中的稳固性区块链毕设代写
区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Ethereum Smart Contracts in Solidity for DApp CITIZEN project – 以太坊智能合约在DApp市民项目中的稳固性区块链毕设代写 是一篇很好的国外资料
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’s
ERC777
andOwnable
already tested contracts and useSafeMath
library - testing done using
Mocha
test framework,Chai
assertion library and Open Zeppelin’sTest Environment
andTest Helpers
- deployment via
Truffle
on Rinkeby Testnet - comments using
NatSpec
format who generate documentation viasolidity-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.
100 CITIZEN
are automatically awarded to any individual who wishes to become a citizen.
An entity called sovereign
is the owner of the state, has the right to register and unregister companies and hospitals, denaturalize citizens and is minted, during token contract deployment, 100% of the supply of CITIZEN
(1 million CTZ
). The owner retains the right to burn
or mint
tokens CTZ
in the future in order to regulate the economy.
Companies
To function a company must be registered by the sovereign using its Ethereum address. It can then buy CTZ
from the sovereign.
A company can recruit employees from the registered citizens, pay them salaries in CITIZEN
tokens and dismiss them.
Hospitals
To function a hospital must be registered by the sovereign using its Ethereum address.
A hospital can change the health status of a registered citizens between healthy and sick, and also can declare dead 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 his current account
, unemployment insurance
, health insurance
and retirement insurance
. Only the current account is at his disposal.
Life events :
- When becoming citizen, he is awarded 100
CTZ
in his current account. - When receiving a salary from his employer 10% of the salary go to his unemployment insurance, 10% to his health insurance, 10% to his retirement insurance and the remaining 70% to his current account.
- When being dismissed by the employer all unemployment insurance tokens are transfered to his current account.
- When being declared sick by a hospital all health insurance tokens are transfered to his current account.
- When requesting for retirement (if has reached retirement age) all unemployment insurance and retirement insurance tokens are transfered to his current account.
- When being declared dead by a hospital all his tokens are given back to the sovereign.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they’re used to log you in. Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
以太坊eth智能合约Solidity for DApp CITIZEN project
演示
安装
安装依赖项:
添加环境变量:
项目详情
代币公民
公司
医院
市民
基本Cookie
始终有效的分析cookies
演示
DApp citide是一个通过在以太坊eth区块链blockchain上部署以Solidity编写的智能合约来创建代币经济和管理虚拟国家及其公民的项目:
令牌.sol处理令牌
政府.sol处理国家事务。
- 合同继承自Open Zeppelin的ERC777,可拥有已测试的合同,并使用SafeMath库
- 使用Mochatest框架进行测试,通过
在健康/无业环境中使用工作环境的 通过工作环境生成健康/无业测试当有可能要求退休等情况时,当他成为公民时,他将在其经常账户中获得100 CTZ。当雇主给他发工资时,工资的10%给他的失业保险,10%的健康保险,10%的退休保险,剩下的70%存入他的经常账户。当他失业时,所有的失业保险金都被雇主解雇了。 - 当医院宣布生病时,所有的健康保险代币都会转到他的活期账户。
- 当申请退休时(如果已达到退休年龄),所有失业保险和退休保险代币都将转入其活期账户。当被医院宣布死亡时,他所有的代币都会归还给君主。在
- 当医院宣布生病时,所有的健康保险代币都会转到他的活期账户。
- 当申请退休时(如果已达到退休年龄),所有失业保险和退休保险代币都将转入其活期账户。当被医院宣布死亡时,他所有的代币都会归还给君主。在
安装依赖项:
添加环境变量:
% yarn install
项目详情
从Infura添加带有两个变量助记符和端点的.env文件,18位小数)作为国家货币和公民身份点数。
100位公民将自动授予任何希望成为公民的个人。
一个名为主权的实体是国家的所有者,有权注册和注销公司和医院,使公民变性,并在代币期间铸造合同部署,100%市民供应(100万箱)。业主保留在未来焚烧或铸造代币的权利,以监管经济。
代币公民
公司
要运行公司,必须由主权国家使用其以太坊eth地址进行注册。公司可以从注册公民中招募员工,用公民代币支付工资,然后解雇他们。
医院
要运行医院,必须由君主使用其以太坊eth地址进行注册。
医院可以在健康和疾病之间更改注册公民的健康状况,也可以宣布死亡为公民。
市民
公民通过以太坊eth地址进行识别,并且可以拥有不同的属性:
基本Cookie
公民的经常账户、失业保险、医疗保险和退休保险之间也有CTZ利差余额。只有往来账户由他支配。
- alive / dead
- healthy / sick
- working / unemployed
- an employer
- a date when it’s possible to ask for retirement etc.
生活事件:
我们使用可选的第三方分析Cookie了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。
- When becoming citizen, he is awarded 100
CTZ
in his current account. - When receiving a salary from his employer 10% of the salary go to his unemployment insurance, 10% to his health insurance, 10% to his retirement insurance and the remaining 70% to his current account.
- When being dismissed by the employer all unemployment insurance tokens are transfered to his current account.
- When being declared sick by a hospital all health insurance tokens are transfered to his current account.
- When requesting for retirement (if has reached retirement age) all unemployment insurance and retirement insurance tokens are transfered to his current account.
- When being declared dead by a hospital all his tokens are given back to the sovereign.
我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。
您可以随时通过单击页面底部的Cookie首选项来更新您的选择。有关更多信息,请参阅我们的隐私声明。
我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多
始终有效的分析cookies
我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Ethereum Smart Contracts in Solidity for DApp CITIZEN project – 以太坊智能合约在DApp市民项目中的稳固性区块链毕设代写