0
아래와 같이 리믹스 편집기에서 ERC20 토큰 스마트 계약 생성을 시도했습니다.Ethereum ERC20 토큰 계약은 리믹스 배포 계약 주소로 월렛에 추가 할 때 토큰 잔액을 반환합니다
스마트 계약을 배포 할 수 있고 모든 변수가 유지되지만 계약서를 wallet.ethereum.org 계약 페이지 (감시 토큰 아래)에 추가하면 토큰 잔액이 으로 표시되고 토큰 심볼 , 이름, 소수 자릿수가 모두 올바르게 등록됩니다.
코드 : 계약을 배포 할 때 당신은 균형을 설정하지 않을
pragma solidity ^0.4.19;
//import './IERC20.sol';
//contract FuncToken is IERC20 {
interface IERC20 {
function totalsupply() constant returns(uint256 total);
function balanceof(address _owner)constant returns(uint256 balance);
function transfer(address to, uint256 value)returns(bool success);
function transferfrom(address from,address to,uint256 _value) returns(bool success);
function approve(address spender,uint256 value)returns(bool success);
function allowance(address owner,address spender)constant returns(uint256 remaining);
event Transfer(address indexed from,address indexed to,uint256 _value);
event Approval(address indexed owner,address indexed spender,uint256 _value);
}
contract PerlToken{
uint public constant _totalSupply=100000;
string public constant symbol="perl";
string public constant name="PERL Token";
uint8 public constant decimals=3;
mapping(address=>uint256) balances;
mapping(address=>mapping(address =>uint256)) allowed;
function FuncToken(){
balances[msg.sender]=_totalSupply;
}
function totalsupply() constant returns(uint256 total){
return _totalSupply;
}
function balanceof(address _owner)constant returns(uint256 balance){
return balances[_owner];
}
function transfer(address to, uint256 value)returns(bool success){
require(
balances[msg.sender]>=_value && _value>0
);
balances[msg.sender] -=_value;
balances[_to] +=+_value;
Transfer(msg.sender,_to,_value);
return true;
}
function transferfrom(address from,address to,uint256 _value) returns(bool success){
require(
allowed[_from][msg.sender]>=_value
&& balances[_from]>=_value
&& _value>0
);
balances[_from]-=_value;
balances[_to]+= _value;
allowed[_from][msg.sender]-=_value;
Transfer(_from,_to,_value);
return true;
}
function approve(address spender,uint256 value)returns(bool success){
allowed[msg.sender][_spender]=_value;
Approval(msg.sender,_spender,_value);
return true;
}
function allowance(address owner,address spender)constant returns(uint256 remaining){
allowed[_owner][_spender];
}
event Transfer(address indexed from,address indexed to,uint256 _value);
event Approval(address indexed owner,address indexed spender,uint256 _value);
}