Home > Blockchain >  The ETH ERC20 tokens, release and intelligent contract generation step
The ETH ERC20 tokens, release and intelligent contract generation step

Time:09-22

1. Installation, create block chain ETH address account

2. To 0.1 ETH
3. Enter the website https://www.myetherwallet.com/for contract release
The first need to login first: click here to login to choose, choose MetaMask, and then select login



4. After logging in the diagram below: choose the arrow mark, click on the Contract first, and then click the Deploy Contract; Appear on the right way is, need to Byte Code and ABI, to write intelligent contract


5 into the online editor:
https://remix.ethereum.org
Contract code as follows, do not do any modification:
Pragma solidity ^ 0.4.16;

Interface tokenRecipient {function receiveApproval (address _from, uint256 _value, address _token, bytes _extraData) public; }

Contract TokenERC20 {
String public name;
String public symbol;
Uint8 public decimals=18;//18 is recommended default value
Uint256 public totalSupply;

The mapping (address=& gt; Uint256) public balanceOf;//
The mapping (address=& gt; The mapping (address=& gt; Uint256) public most egregious nest-feathering;

The event Transfer (address indexed from, address indexed to the uint256 value);

The event Burn (address indexed from, uint256 value);


The function TokenERC20 (uint256 initialSupply, string tokenName, string tokenSymbol) public {
TotalSupply=initialSupply * 10 * * uint256 (decimals);
BalanceOf [MSG. Sender]=totalSupply;
Name=tokenName;
Symbol=tokenSymbol;
}


The function _transfer (address _from, address _to, uint _value) internal {
Require (_to!=0 x0);
Require (balanceOf [_from] & gt; _value=);
Require (balanceOf [_to] + _value & gt; BalanceOf [_to]);
Uint previousBalances=balanceOf balanceOf [_from] + [_to];
BalanceOf [_from] -=_value;
BalanceOf [_to] +=_value;
Transfer (_from, _to _value);
Assert (balanceOf balanceOf [_from] + [_to]==previousBalances);
}

The function transfer (address _to, uint256 _value) public returns (bool) {
_transfer (MSG) sender, _to, _value);
return true;
}

The function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) {
Require (_value & lt;=most egregious nest-feathering [_from] [MSG. Sender]);//Check most egregious nest-feathering
The most egregious nest-feathering [_from] [MSG. Sender] -=_value;
_transfer (_from, _to _value);
return true;
}

The function the approve (address _spender, uint256 _value) public
Returns (bool success) {
Most egregious nest-feathering [MSG. Sender] [_spender]=_value;
return true;
}

The function approveAndCall (address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
TokenRecipient spender=tokenRecipient (_spender);
If (approve (_spender _value)) {
Spender. ReceiveApproval (MSG) sender, _value, this, _extraData);
return true;
}
}

The function burn (uint256 _value) public returns (bool success) {
Require (balanceOf [MSG. Sender] & gt; _value=);
BalanceOf [MSG. Sender] -=_value;
TotalSupply -=_value;
Burn (MSG) sender, _value);
return true;
}

The function burnFrom (address _from, uint256 _value) public returns (bool success) {
Require (balanceOf [_from] & gt; _value=);
Require (_value & lt;=most egregious nest-feathering [_from] [MSG. Sender]);
BalanceOf [_from] -=_value;
The most egregious nest-feathering [_from] [MSG. Sender] -=_value;
TotalSupply -=_value;
Burn (_from _value);
return true;
}
}


Then began to compile after 6: code copy: click on the following figure





Select the corresponding version (I this is just a screenshot, you choose your own)


Click the compile: ABI in the lower left corner and the ByteCode; This in the previous screenshots useful to copy to summer orders, the corresponding position:


The number of tokens for HTUT, I am here for a number of $

And then submit, he will show you to continue to trade payment, is the fee for absenteeism, click on the top right corner will be a payment message, below


Click on the confirmation, after the success of the payment, and then he will automatically deploy contracts, wait a minute, to block the browser check your ETH Lord account things: address is: https://etherscan.io/address/(add your own pay the costs of miners ETH account address); Click to enter




Under the plan for your tokens, address, and then view the tokens of specific information: address is:
https://etherscan.io/token/(your own tokens, address)



CodePudding user response:

I'm a reply to test any points
  • Related