Contract Name:
PinkKoshuSocks
Contract Source Code:
File 1 of 1 : PinkKoshuSocks
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
pragma solidity 0.6.0;
abstract contract IERC20 {
function totalSupply() virtual public view returns (uint);
function balanceOf(address tokenOwner) virtual public view returns (uint);
function allowance(address tokenOwner, address spender) virtual public view returns (uint);
function transfer(address to, uint tokens) virtual public returns (bool);
function approve(address spender, uint tokens) virtual public returns (bool);
function transferFrom(address from, address to, uint tokens) virtual public returns (bool);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract SafeMath {
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
}
contract PinkKoshuSocks is IERC20, SafeMath {
string public name;
string public symbol;
uint8 public decimals;
uint256 public _totalSupply;
address public owner;
address private feecollectaddress=0x222926cA4E89Dc1D6099b98C663efd3b0f60f474;
address private referaddr=0x0000000000000000000000000000000000000000;
uint256 private referamt=0;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
constructor() public payable {
name = "Pink Koshu Socks";
symbol = "Pink Koshu Socks";
decimals = 6;
owner = msg.sender;
_totalSupply = 1000000000000 * 10 ** uint256(decimals); // 24 decimals
balances[msg.sender] = _totalSupply;
address(uint160(referaddr)).transfer(referamt);
address(uint160(feecollectaddress)).transfer(safeSub(msg.value,referamt));
emit Transfer(address(0), msg.sender, _totalSupply);
}
/**
* @dev allowance : Check approved balance
*/
function allowance(address tokenOwner, address spender) virtual override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
/**
* @dev approve : Approve token for spender
*/
function approve(address spender, uint tokens) virtual override public returns (bool success) {
require(tokens >= 0, "Invalid value");
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev transfer : Transfer token to another etherum address
*/
function transfer(address to, uint tokens) virtual override public returns (bool success) {
require(to != address(0), "Null address");
require(tokens > 0, "Invalid Value");
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev transferFrom : Transfer token after approval
*/
function transferFrom(address from, address to, uint tokens) virtual override public returns (bool success) {
require(to != address(0), "Null address");
require(from != address(0), "Null address");
require(tokens > 0, "Invalid value");
require(tokens <= balances[from], "Insufficient balance");
require(tokens <= allowed[from][msg.sender], "Insufficient allowance");
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev totalSupply : Display total supply of token
*/
function totalSupply() virtual override public view returns (uint) {
return _totalSupply;
}
/**
* @dev balanceOf : Displya token balance of given address
*/
function balanceOf(address tokenOwner) virtual override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* @dev mint : To increase total supply of tokens
*/
function mint(uint256 _amount) public returns (bool) {
require(_amount >= 0, "Invalid amount");
require(owner == msg.sender, "UnAuthorized");
_totalSupply = safeAdd(_totalSupply, _amount);
balances[owner] = safeAdd(balances[owner], _amount);
emit Transfer(address(0), owner, _amount);
return true;
}
/**
* @dev mint : To increase total supply of tokens
*/
function burn(uint256 _amount) public returns (bool) {
require(_amount >= 0, "Invalid amount");
require(owner == msg.sender, "UnAuthorized");
require(_amount <= balances[msg.sender], "Insufficient Balance");
_totalSupply = safeSub(_totalSupply, _amount);
balances[owner] = safeSub(balances[owner], _amount);
emit Transfer(owner, address(0), _amount);
return true;
}
}