Smart Contract – 智能合约区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Smart Contract – 智能合约区块链毕设代写 是一篇很好的国外资料

Smart Contract

Our new startup company has created an Ethereum-compatible blockchain to help on our finances, increase transparency and to automate accounting and auditing. We used the Solidity smart contract to complete this project.

First we created an AssociateProfitSplitter contract. In this contract we accept Ether into the contract and divide the Ether evenly among the associate level employees. This allows the Human Resources department to pay employees quickly and efficiently.

In our company’s management level we created a TieredProfitSplitter that distributes different percentages of incoming Ether to the corporate officers at different tiers. In this contract the CEO gets paid 60%, CTO 25%, and Bob, the VP gets 15%.

We used Remix IDE, Ganache (https://www.trufflesuite.com/ganache) and MetaMask to create, compile and deploy the contracts.

To create AssociateProfitSplitter contract, we did the following:

  • Created the public variables, set payable to each employee’s address;

  • Created a constructor function that accepts ether;

  • Created balance function to set to `public view returns(uint)’;

  • Created deposit function set to public payable to ensure only the owner can call the function;

  • We used msg.value to account for any leftover wei and send it back to Human Resources.

To create TieredProfitSplitter contract, we did the following:

  • Calculated rudimentary percentages for different tiers of employees (CEO, CTO, and Bob).

  • Calculated the number of points by dividing msg.value by 100.

  • Multiplied the points with a number representing a percentage, points * 60, 25 or 15 which would output a number that is corresponding to the tiers of the msg.value.

  • Transferred the amount to each employee, setting the amount to equal the points multiplied by their given percentage.

  • Send the remainder to the employee with the highest percentage by subtracting total from msg.value.

We successfully deployed the contracts. Please see the attached screenshots.


智能合约

我们新成立的公司已经创建了一个与以太坊eth兼容的区块链blockchain,以帮助我们改善财务状况,提高透明度,并实现会计和审计自动化。我们使用Solidity智能合约来完成这个项目

首先,我们创建了一个AssociateProfitSplitter合同。在本合同中,我们将乙醚纳入合同,并将乙醚平均分配给员工。这使得人力资源部能够快速高效地向员工支付工资

在我们公司的管理层,我们创建了一个分层利润分配器,将不同比例的乙醚分配给不同层级的公司高管。在这份合同中,首席执行官的工资为60%,首席技术官的工资为25%,副总裁鲍勃的工资为15%

我们使用了混音IDE,Ganache(https://www.trufflesuite.com/ganache)和元掩码来创建、编译和部署契约

要创建AssociateProfitSplitter合约,我们执行了以下操作:

  • 创建了公共变量,设置为每个员工的地址
  • 创建了一个接受以太的构造函数
  • 创建了平衡函数,将其设置为“公共视图返回(uint)”
  • 创建了设置为公共应付的存款功能,以确保只有所有者才能调用该功能
  • 我们使用msg.value来说明剩余的wei,并将其发送回人力资源部

要创建TieredProfitSplitter合约,我们执行了以下操作:

  • 通过将msg.value除以100来计算点数。
  • 将点数乘以一个表示百分比的数字,即点*60、25或15,这将输出一个与msg.value层对应的数字
  • 将金额转移给每位员工,将金额设置为等于点数乘以他们给定的百分比
  • 通过从msg.value中减去total,将剩余部分发送给百分比最高的员工
  • 通过从msg.value中减去total,将剩余部分发送给百分比最高的员工

我们成功地部署了合同。请参阅附加的屏幕截图

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情