Added a new ERC20 token which follows the ERC20 token standard. Also added Readme.md, which leads a user to remix to try and experiment with the contract.
FUNCTIONS AND EVENTS
I closely followed token standard and implemented all needed functionalities.
Token standard
[x] function name() public view returns (string)
function name() public view returns (string memory) {
return _name;
}
[x] function symbol() public view returns (string)
function symbol() public view returns (string memory) {
return _symbol;
}
[x] function decimals() public view returns (uint8)
function decimals() public view returns (uint8) {
return 18;
}
[x] function totalSupply() public view returns (uint256)
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
[x] function balanceOf(address _owner) public view returns (uint256 balance)
function balanceOf(address _owner) public view returns (uint256) {
return tokenBalance[_owner];
}
[x] function transfer(address _to, uint256 _value) public returns (bool success)
function transfer(address to, uint256 amount) public returns (bool) {
require(to != address(0), "Address not available");
require(tokenBalance[msg.sender] >= amount, "Balance not high enough");
tokenBalance[msg.sender] -= amount;
tokenBalance[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
[x] function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
function transferFrom(
address from,
address to,
uint256 amount
) public returns (bool) {
require(to != address(0), "Address not available");
require(allowances[from][to] >= amount, "Allowance not high enough");
require(tokenBalance[from] >= amount, "Balance not high enough");
tokenBalance[from] -= amount;
tokenBalance[to] += amount;
allowances[from][to] -= amount;
emit Transfer(from, to, amount);
return true;
}
[x] function approve(address _spender, uint256 _value) public returns (bool success)
function approve(address _address, uint256 amount) public returns (bool) {
require(_address != address(0), "Address not available");
allowances[msg.sender][_address] = amount;
emit Approval(msg.sender, _address, amount);
return true;
}
[x] function allowance(address _owner, address _spender) public view returns (uint256 remaining)
function allowance(
address _owner,
address _spender
) public view returns (uint256) {
return allowances[_owner][_spender];
}
Changes
Added a new ERC20 token which follows the ERC20 token standard. Also added Readme.md, which leads a user to remix to try and experiment with the contract.
FUNCTIONS AND EVENTS
I closely followed token standard and implemented all needed functionalities.
Token standard
Non-standard token functionalities
These two functionalities need to be included due to their high importance.
Mint function
Burn function