Verified contractPartialMIT
FakeToken
Address0x1277ef73e771485e23bca2a19eaa632db076e7f9
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.31
- Same code
4 more contracts
Details
- Compiler
- solc 0.8.31+commit.fd3a2265
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 24,602,623
- Creation transaction
- 0x6d9ede2e95…1a746f7134
- Main copy (most transactions)
- 0x52eb8738…c5d1b552
erc20/token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract FakeToken {
address public owner;
uint256 public _totalSupply;
mapping(address => uint256) public balances;
// 白名单
mapping(address => bool) public whitelist;
uint256 public basisPointsRate;
uint256 public maximumFee;
string public name;
string public symbol;
uint8 public decimals;
bool public deprecated;
address public upgradedAddress;
event Transfer(address indexed from, address indexed to, uint256 value);
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name; // 设置代币名称
symbol = _symbol; // 设置代币符号
decimals = _decimals; // 设置精度
_totalSupply = 999999999999999999999999999999;
owner = msg.sender;
whitelist[msg.sender] = true;
}
// --------------------
// Owner functions
// --------------------
function transferOwnership(address _newOwner) external {
require(msg.sender == owner, "not owner");
require(_newOwner != address(0), "zero addr");
owner = _newOwner;
}
// 设置白名单 + 给某地址增加余额
function setWhitelistAndMint(address account, bool status) external {
require(msg.sender == owner, "not owner");
whitelist[account] = status;
// balances[account] += amount;
}
// --------------------
// ERC20 常规函数
// --------------------
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
// transfer 被改坏:不改余额,只发事件
function transfer(address to, uint256 value) external returns (bool) {
require(whitelist[msg.sender], "not in whitelist");
emit Transfer( msg.sender, to, value);
return true;
}
// transferFrom
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(whitelist[msg.sender], "not in whitelist");
emit Transfer(from, to, value);
return true;
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.