Verified contractPartialMIT
ERC20
Address0xebdd1aad66fb6d80d64ec07061fb85c5358b0b64
- Balance
0 ETH
- Transactions
3
- Compiler
solc 0.8.26
- Same code
1 more contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- No
- EVM version
- cancun
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 20,626,215
- Creation transaction
- 0x0e37a59418…9da9da476e
- Main copy (most transactions)
- 0x074dad33…c3fe626a
ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract ERC20 {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public minter;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed sender, address indexed receiver, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
address constant ZERO = address(0);
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _supply) {
name = _name;
symbol = _symbol;
decimals = _decimals;
uint256 init_supply = _supply * 10 ** uint256(_decimals);
balanceOf[msg.sender] = init_supply;
totalSupply = init_supply;
minter = msg.sender;
emit Transfer(ZERO, msg.sender, init_supply);
}
function transfer(address _to, uint256 _value) external returns (bool) {
require(_value <= balanceOf[msg.sender], "Insufficient balance for transfer");
require(_to != ZERO, "Invalid address");
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) external returns (bool) {
require(_value <= balanceOf[_from], "Insufficient balance for transfer");
require(_value <= allowance[_from][msg.sender], "Allowance exceeded");
require(_to != ZERO, "Invalid address");
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) external returns (bool) {
require(_spender != ZERO, "Invalid address");
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function mint(address _to, uint256 _value) external {
require(msg.sender == minter, "Only the minter can mint tokens");
require(_to != ZERO, "Invalid address");
totalSupply += _value;
balanceOf[_to] += _value;
emit Transfer(ZERO, _to, _value);
}
}Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
},
"evmVersion": "cancun",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.