// SPDX-License-Identifier: MIT
// https://seniorblockchain.io
// Security-Contact: [email protected]
pragma solidity ^0.8.20;
interface ISenior {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Senior is ISenior {
using SafeMath for uint256;
string public name = "Senior";
string public symbol = "SNR";
uint8 public decimals = 18;
uint256 private _totalSupply = 256000000 * 10**uint256(decimals);
mapping(address => uint256) private balances;
mapping(address => mapping(address => uint256)) private allowances;
constructor(address initialRecipient) {
balances[initialRecipient] = _totalSupply;
emit Transfer(address(0), initialRecipient, _totalSupply);
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address tokenOwner) public view override returns (uint256) {
return balances[tokenOwner];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
require(amount <= balances[msg.sender], "Insufficient balance");
_transfer(msg.sender, recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public override returns (bool) {
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return allowances[owner][spender];
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
require(amount <= balances[sender], "Insufficient balance");
require(amount <= allowances[sender][msg.sender], "Allowance exceeded");
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, allowances[sender][msg.sender].sub(amount));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
balances[sender] = balances[sender].sub(amount);
balances[recipient] = balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "Subtraction overflow");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "Addition overflow");
return c;
}
}
-
-
Notifications
You must be signed in to change notification settings - Fork 0
License
seniorblockchain/SeniorToken
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published