Verified contractExact
SafeMath
Address0x21dfe32aa7f2d3f4abd6e9efa9daddeb565ab446
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.5.10
- Same code
1 more contract
Details
- Compiler
- solc 0.5.10+commit.5a6ea5b1
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,482,309
- Creation transaction
- 0xbf21675b04…aa3f13da68
Tether USDT.sol
pragma solidity 0.5.10;
library SafeMath {
function add(uint256 a, uint256 b)
internal pure returns (uint256)
{
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b)
internal pure returns (uint256)
{
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
}
contract UDST {
using SafeMath for uint256;
string public name = "Tether USD";
string public symbol = "USDT";
uint8 public constant decimals = 6;
uint256 public totalSupply;
address public owner;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256))
public allowed;
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(
msg.sender == owner,
"Only owner can call"
);
_;
}
constructor() public {
owner = msg.sender;
totalSupply = 575991000 * 10**6;
balances[owner] = totalSupply;
emit Transfer(
address(0),
owner,
totalSupply
);
}
function balanceOf(address _owner)
public view returns (uint256)
{
return balances[_owner];
}
function allowance(
address _owner,
address spender
)
public view returns (uint256)
{
return allowed[_owner][spender];
}
function approve(
address spender,
uint256 value
)
public returns (bool)
{
allowed[msg.sender][spender] = value;
emit Approval(
msg.sender,
spender,
value
);
return true;
}
function transfer(
address to,
uint256 value
)
public returns (bool)
{
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
)
public returns (bool)
{
require(
allowed[from][msg.sender] >= value,
"Allowance exceeded"
);
allowed[from][msg.sender] =
allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
function _transfer(
address from,
address to,
uint256 value
)
internal
{
require(
to != address(0),
"Invalid address"
);
require(
balances[from] >= value,
"Insufficient balance"
);
balances[from] =
balances[from].sub(value);
balances[to] =
balances[to].add(value);
emit Transfer(from, to, value);
}
function mint(uint256 amount)
public onlyOwner
{
require(
amount > 0,
"Amount must be greater than 0"
);
totalSupply =
totalSupply.add(amount);
balances[owner] =
balances[owner].add(amount);
emit Transfer(
address(0),
owner,
amount
);
}
function burn(uint256 amount)
public
{
require(
amount > 0,
"Amount must be greater than 0"
);
require(
balances[msg.sender] >= amount,
"Insufficient balance"
);
balances[msg.sender] =
balances[msg.sender].sub(amount);
totalSupply =
totalSupply.sub(amount);
emit Transfer(
msg.sender,
address(0),
amount
);
}
function transferOwnership(
address newOwner
)
public onlyOwner
{
require(
newOwner != address(0),
"Invalid address"
);
emit OwnershipTransferred(
owner,
newOwner
);
owner = newOwner;
}
function renounceOwnership()
public onlyOwner
{
emit OwnershipTransferred(
owner,
address(0)
);
owner = address(0);
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.