// transfer token for a specified address
function transfer(address _to, uint _amount) public {
require(balances[msg.sender] > _amount);
balances[msg.sender] -= _amount;
balances[_to] += _amount;
} // Get the balance of the specified address // Constant and Immutable State Variables. See https://docs.soliditylang.org/en/v0.8.10/contracts.html#modifiers
function balanceOf(address _owner) public view returns (uint) {
return balances[_owner];
}
}
在migrations資料夾新增
var HelloWorld = artifacts.require("HelloWorld");
var MyToken = artifacts.require("MyToken");