Verified contractPartial
BasicToken
Address0x2f99beaa454b26ee1af067f0eb84ffa13015bbb0
- Balance
0 ETH
- Transactions
96
- Compiler
solc 0.4.24
- Same code
6 more contracts
Details
- Compiler
- solc 0.4.24+commit.e67f0147
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 8,122,056
- Creation transaction
- 0x6964ceff8d…a56a6ad1fa
- Main copy (most transactions)
- 0xd17f8c64…1bf53427
BasicToken.sol
pragma solidity ^0.4.23;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title 实现ERC20基本合约的接口
* @dev 基本的StandardToken,不包含allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals,uint256 totalSupply) public {
balances[msg.sender] = totalSupply;
totalSupply_ = totalSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev 返回存在的token总数
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev 给特定的address转token
* @param _to 要转账到的address
* @param _value 要转账的金额
*/
function transfer(address _to, uint256 _value) public returns (bool) {
//做相关的合法验证
require(_to != address(0));
require(_value <= balances[msg.sender]);
// msg.sender余额中减去额度,_to余额加上相应额度
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
//触发Transfer事件
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev 获取指定address的余额
* @param _owner 查询余额的address.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}Compiler settingsShow
{
"optimizer": {
"runs": 0,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.