Deploy Ethereum smart contract (Token release)

Keywords: Blockchain

pragma solidity ^0.4.24;

contract EIP20Interface{
    //Get the balance of the owner address
    function balanceOf(address _owner) public view returns (uint256 balance);
    //Transfer: transfer in ﹐ value tokens from one's own account to ﹐ address
    function transfer(address _to, uint256 _value)public returns (bool success);
    //Transfer: transfer from to value tokens
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
    //Allow spender to transfer ﹐ value tokens from his (caller's) account
    function approve(address _spender, uint256 _value) returns (bool success);
    //How many tokens can I transfer by querying my own spender address
    function allowance(address _owner, address _spender) view returns (uint256 remaining);
    //Time that must be called during transfer, such as Tranfer,TransferFrom
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    //Events invoked after successful execution of approve method
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

contract YJCToken is EIP20Interface {
    //1. Get the token name, such as "Yang coin"
    string public name;
     //2. Get the Token abbreviation, such as "YJC"
    string public symbol;
    //3. Obtain decimal places. For example, the decimals of Ethereum is 18
    uint8 public decimals;
     //4. Obtain the total number of token releases, such as HT 500 million
    uint256 public totalSupply;

    mapping(address=>uint256) balances ;
    mapping(address=>mapping(address=>uint256)) allowances;
    function YJCToken(string _name,string _symbol, uint8 _decimals,uint256 _totalSupply) public{       
    name = _name;
    symbol = _symbol;
    decimals = _decimals;
    totalSupply = _totalSupply;
    balances[msg.sender] = _totalSupply;
    }

    //Get the balance of the owner address
    function balanceOf(address _owner) public view returns (uint256 balance){
        return balances[_owner];
    }
    //Transfer: transfer in ﹐ value tokens from one's own account to ﹐ address
    function transfer(address _to, uint256 _value)public  returns (bool success){
        require(_value >0 && balances[_to] + _value > balances[_to] && balances[msg.sender] > _value);
        balances[_to] += _value;
        balances[msg.sender] -= _value;
        Transfer(msg.sender, _to,_value);

        return true;
    }

    //Transfer: transfer from to value tokens
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success){
        uint256 allowan = allowances[_from][_to];
        require(allowan > _value && balances[_from] >= _value && _to == msg.sender && balances[_to] + _value>balances[_to]);
        allowances[_from][_to] -= _value;
        balances[_from] -= _value;
        balances[_to] += _value;
        Transfer(_from,_to,_value);
        return true;
    }
    //Allow spender to transfer ﹐ value tokens from his (caller's) account
    function approve(address _spender, uint256 _value) returns (bool success){
        require(_value >0 && balances[msg.sender] > _value);
        allowances[msg.sender][_spender] = _value;
        Approval(msg.sender,_spender,_value);
                return true;
    }
    //How many tokens can I transfer by querying my own spender address
    function allowance(address _owner, address _spender) view returns (uint256 remaining){
        return allowances[_owner][_spender];
    }

}

Fill in Token initialization parameters

Note: total number of issues = ﹣ totalsupply / ﹣ decisions, where 100 yjcs are issued

Click transact and the interface will pop up automatically. The balance of the new account is 0 eth.

You need to get a certain amount of Ethernet currency before you can deploy the smart contract

 

Repeat transact and click OK

Directly obtain the parameter value at Ramix end:

Deployment success

Query the Token balance of the account

Note: token contact address is the generated token contract address

Click here to paste

This token can also be transferred to others

Posted by beebum on Sat, 22 Feb 2020 09:22:08 -0800