Advanced-Solidity – 先进的坚固性区块链毕设代写

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

Advanced-Solidity

ERC20 Crowdsale

Advanced-Solidity - 先进的坚固性

Background

Your company has decided to crowdsale their PupperCoin token in order to help fund the network development. This network will be used to track the dog breeding activity across the globe in a decentralized way, and allow humans to track the genetic trail of their pets. You have already worked with the necessary legal bodies and have the green light on creating a crowdsale open to the public. However, you are required to enable refunds if the crowdsale is successful and the goal is met, and you are only allowed to raise a maximum of 300 Ether. The crowdsale will run for 24 weeks.

Here we have created an ERC20 token that will be minted through a Crowdsale contract leverage from the OpenZeppelin Solidity library.

This crowdsale contract will manage the entire process, allowing users to send ETH and get back the token. This contract will mint the tokens automatically and distribute them to buyers in one transaction.

Designing the contracts

ERC20 PupperCoin

Within the PupperCoin.sol contrct we used a standard ERC20Mintable and ERC20Detailed contract, hardcoding 18 as the decimals parameter, and leaving the initial_supply parameter alone.

PupperCoinCrowdsale

Here the Crowdsale.sol inherits the following OpenZeppelin contracts:

  • Crowdsale

  • MintedCrowdsale

  • CappedCrowdsale

  • TimedCrowdsale

  • RefundablePostDeliveryCrowdsale

You will need to provide parameters for all of the features of your crowdsale, such as the name, symbol, wallet for fundraising, goal, etc. Feel free to configure these parameters to your liking.

You can hardcode a rate of 1, to maintain parity with Ether units (1 TKN per Ether, or 1 TKNbit per wei).

Since RefundablePostDeliveryCrowdsale inherits the RefundableCrowdsale contract, which requires a goal parameter, you must call the RefundableCrowdsale constructor from your PupperCoinCrowdsale constructor as well as the others. RefundablePostDeliveryCrowdsale does not have its own constructor, so just use the RefundableCrowdsale constructor that it inherits.

For the open and close times, we use now and now + 24 weeks to set the times for the PupperCoinCrowdsaleDeployer contract.

PupperCoinCrowdsaleDeployer

Here we create the PupperCoin, create the PupperCoinSale and mont the token.

Testing the Crowdsale

Deploy PupperCoinSaleDeployer

Advanced-Solidity - 先进的坚固性

Deploy PupperCoinSale

Advanced-Solidity - 先进的坚固性

Purchase Token

Advanced-Solidity - 先进的坚固性

Check Cap and Balance

Advanced-Solidity - 先进的坚固性

Check wei raised

Advanced-Solidity - 先进的坚固性

Fakenow Test

Advanced-Solidity - 先进的坚固性

Advanced-Solidity - 先进的坚固性

Kovan Test Net

Deploy to the Kovan Test Net

Advanced-Solidity - 先进的坚固性

Confirm transaction on Kovan Etherscan

Advanced-Solidity - 先进的坚固性

Deploy PupperCoinSale

Advanced-Solidity - 先进的坚固性

Purchase Token

Advanced-Solidity - 先进的坚固性

Advanced-Solidity - 先进的坚固性

Confirm Transaction on Kovan Etherscan

Advanced-Solidity - 先进的坚固性

Check Balance

Advanced-Solidity - 先进的坚固性

Check wei raised

Advanced-Solidity - 先进的坚固性

Add token to MetaMask

Advanced-Solidity - 先进的坚固性

Advanced-Solidity - 先进的坚固性

fakenow


Advanced-Solidity

ERC20 Crowdsale

贵公司已决定众售他们的PupperCoin代币,以资助网络发展。这个网络将被用来以分散的方式追踪全球的养狗活动,并允许人类追踪宠物的基因轨迹。你已经与必要的法律机构合作,并为创建面向公众的众售开了绿灯。但是,如果众筹成功并且达到了目标,您需要启用退款,并且您最多只能筹集300英镑。众筹将持续24周

Background

我们在这里创建了一个ERC20代币,它将通过OpenZeppelin Solidity图书馆的众售合同铸造

这个众包合同将管理整个过程,允许用户发送ETH并取回代币。此合同将自动铸造代币,并在一次交易中将其分配给买家

在PupperCoin.sol合同中,我们使用了标准的ERC20可维护和ERC20详细合同,硬编码18作为小数参数,而不使用初始的供应参数

Designing the contracts

ERC20 PupperCoin

在这里,Crowdsale.sol继承了以下OpenZeppelin合同:

PupperCoinCrowdsale

众售

  • TimedCrowdsale
  • 配送后可退款众售
  • TimedCrowdsale

  • 可退款的PostDeliveryCrowdsale

  • 您需要为众售的所有功能提供参数,例如名称、符号,钱包筹款,目标等,请随意配置这些参数,你喜欢的

您可以将速率硬编码为1,以保持与乙醚单位的奇偶性(每乙醚1 TKN,或每魏1 TKNbit)

由于ReturnablePostDeliveryCrowdsale继承了ReturnableCrowdsale合同,该合同需要一个目标参数,因此您必须从PupperCoinCrowdsale构造函数以及其他构造函数中调用ReturnableCrowdsale构造函数。ReturnablePostDeliveryCrowdsale没有自己的构造函数,所以只需使用它继承的ReturnableCrowdsale构造函数即可

对于开放和关闭时间,我们使用now和now+24周来设置PupperCoinCrowdsaleDeployer合同的时间

在这里,我们创建PupperCoin,创建PupperCoinSale和mont代币

PupperCoinCrowdsaleDeployer

Here we create the PupperCoin, create the PupperCoinSale and mont the token.

Testing the Crowdsale

Deploy PupperCoinSaleDeployer

Advanced-Solidity - 先进的坚固性

Deploy PupperCoinSale

Advanced-Solidity - 先进的坚固性

Purchase Token

Advanced-Solidity - 先进的坚固性

Check Cap and Balance

Advanced-Solidity - 先进的坚固性

Check wei raised

Advanced-Solidity - 先进的坚固性

Fakenow Test

Advanced-Solidity - 先进的坚固性

Advanced-Solidity - 先进的坚固性

Kovan Test Net

Deploy to the Kovan Test Net

Advanced-Solidity - 先进的坚固性

Confirm transaction on Kovan Etherscan

Advanced-Solidity - 先进的坚固性

Deploy PupperCoinSale

Advanced-Solidity - 先进的坚固性

Purchase Token

Advanced-Solidity - 先进的坚固性

Advanced-Solidity - 先进的坚固性

Confirm Transaction on Kovan Etherscan

Advanced-Solidity - 先进的坚固性

Check Balance

Advanced-Solidity - 先进的坚固性

Check wei raised

Advanced-Solidity - 先进的坚固性

Add token to MetaMask

Advanced-Solidity - 先进的坚固性

Advanced-Solidity - 先进的坚固性

fakenow

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情