Solidity – 坚固性区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Solidity – 坚固性区块链毕设代写 是一篇很好的国外资料

Solidity

Smart Contracts – Three Different Applications

In this file, I’ve created three different types of profitsplitter smart contracts,

  1. Associate Profit Splitter: Divides the profit equally between employees with remainder going back to the company
  2. Tiered Profit Splitter: Distributes profits to different employee tiers (CEO, CTO, Bob)
  3. Deferred Equity Plan: Distributes “deffered equity incentives” automatically.

Associate Profit Splitter Contract

In this contract, the user enters the wallet addresses of the employees as well as the profit in the value field. The value is then divided equally between employees, with any leftover wei going back to the Human Resources.

In this screenshot, I am using my local network to send 10 ETH to 3 diff addresses .

Solidity - 坚固性

After clicking on the deposit function in the associateprofit contract, HR (wallet address with index 0) has successfully sent 3.33 ETH each to the 3 target addresses (address with index 1,2,3). See below sreenshot.

Solidity - 坚固性

The whole process is also outlined here using a profit sample of 5 ETH that was equally distributed to the 3 addresses (note that the starting and ending balance is different from the screenshots beforehand because of the transactions that happened in between):

Solidity - 坚固性


Tiered Profit Splitter Contract

In this contract, we do something similar to the above, but send profits to each employee based on tier or rank. These are our 3 employee tiers:

  • CEO : Receives 60% of the profit. Employee address is Index 4
  • CTO : Receives 25% of the profit. Employee address is Index 5
  • Bob: Recieves 15% of the profit. Employee address is Index 6

To do this, we divide the contract’s value (profit) into 100 “points”. Then we multiply the points by each employee’s share.

Address amounts BEFORE tiered profit splitting: Solidity - 坚固性

Address amounts AFTER tiered profit splitting: Solidity - 坚固性

Finally, See GIF below on how the contract works based on a 10 ETH profit. Note that the contract was deployed in my local network. Solidity - 坚固性


Deferred Equity Plan Contract

In this contract, we are distributing an employees’ share over 4 years. The contract has 1000 shares and 250 shares are distributed every year. To prevent disbursement of too many shares, this account will require that the sender is HR and that the account is locked for 365 days after the shares are transferred to the employee. In other words, the employee can get the next round of shares only after 365 days up to the maximum number of shares allowed.

For testing purposes, I used a fastforward function to be able to test the distribute function several times without locking the account.

For this example, I used the Kovan ETH testnet to deploy my smart contract. We can see from below that both my Remix console and MetaMask extension are connected to the Kovan network.

Solidity - 坚固性

After runnning the distribute function, there are now 250 shares in the employees’ wallet. Solidity - 坚固性

See GIF below for the whole contract process. Note that to run this on the Kovan testnetwork, you will need some test ETH. Solidity - 坚固性

You can also view this transaction in a block explorer: This transaction in a block explorer


稳定度

智能合约-三种不同的应用程序

在这个文件中,我创建了三种不同类型的profitsplitter智能合约,

  1. 关联利润拆分器:在员工之间平均分配利润,剩余部分归公司。
  2. 分层利润拆分器:将利润分配给不同的员工层(CEO、CTO、Bob)
  3. 递延股权计划:自动分配“递延股权激励”。

关联利润分割合约

在这个合约中,用户输入员工的钱包地址以及价值字段中的利润。然后,价值在员工之间平均分配,剩余部分归人力资源部。

在这个屏幕截图中,我使用我的本地网络将10个ETH发送到3个不同的地址。

Solidity - 坚固性

单击associateprofit合同中的存款功能后,HR(索引为0的钱包地址)已成功向3个目标地址(索引为1、2、3的地址)分别发送3.33 ETH。见下文。

Solidity - 坚固性

本文还使用平均分配到3个地址的5个ETH利润样本概述了整个过程(注意,由于在这两个地址之间发生的交易,起始和结束余额与之前的屏幕截图不同):

Solidity - 坚固性


分层利润分割合约

在这份合同中,我们做了与上述类似的事情,但根据级别或职级将利润分配给每位员工。这是我们的3个员工层级:

  • 首席执行官:获得60%的利润。员工地址为索引4,CTO:获得25%的利润。员工地址是索引5,鲍勃:获得15%的利润。员工地址为索引6
  • CTO : Receives 25% of the profit. Employee address is Index 5
  • Bob: Recieves 15% of the profit. Employee address is Index 6

为此,我们将合同价值(利润)分为100个“点”。然后我们用每个雇员的份额乘以这些分数。

解决分层利润分割前的金额:Solidity - 坚固性

解决分层利润分割后的金额:Solidity - 坚固性

最后,请参阅下面的GIF,了解基于10 ETH利润的合同如何运作。请注意,契约部署在我的本地网络中。在本合同中,我们将在4年内分配员工的股份。合同有1000股,每年发行250股。为防止支付过多股份,此帐户将要求发件人是HR,并且在股份转让给员工后365天内锁定帐户。换言之,员工只有在365天后才能获得下一轮股票,最多可获得允许的最大数量的股票。


递延股权计划合约

出于测试目的,我使用了一个fastforward函数,可以在不锁定帐户的情况下多次测试distribute函数。

在这个例子中,我使用了kovaneth测试网来部署我的智能合约。我们可以从下面看到,我的混音控制台和MetaMask扩展都连接到Kovan网络。

Solidity - 坚固性

运行distribute功能后,员工钱包中现在有250份股票。整个合同过程见下面的GIF。请注意,要在Kovan testnetwork上运行这个程序,您需要进行一些测试。Solidity - 坚固性

您也可以在块资源管理器中查看此交易:在块资源管理器中查看此交易

See GIF below for the whole contract process. Note that to run this on the Kovan testnetwork, you will need some test ETH. Solidity - 坚固性

You can also view this transaction in a block explorer: This transaction in a block explorer

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/20467.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Solidity – 坚固性区块链毕设代写

提供最优质的资源集合

立即查看 了解详情