Verified contractExactMIT
USD_T
Address0xe825f0f75b4e30ce0f16def0711f0faf46bdbfa0
- Balance
0 ETH
- Transactions
10
- Compiler
solc 0.8.37
- Same code
Only this contract
Details
- Compiler
- solc 0.8.37+commit.f401782d
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,349,908
- Creation transaction
- 0xc54b34ad52…3d8d004861
etherium_usd_t.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC20Recovery {
function transfer(address to, uint256 amount) external returns (bool);
}
contract USD_T {
string public constant name = "USD\u0166";
string public constant symbol = "USD\u0166";
uint8 public constant decimals = 18;
uint256 public constant totalSupply = 499_000_000_000 * 10**18;
address public immutable deployer;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event ETHRecovered(address indexed to, uint256 amount);
event TokenRecovered(address indexed token, address indexed to, uint256 amount);
modifier onlyDeployer() {
require(msg.sender == deployer, "Only deployer");
_;
}
constructor() {
deployer = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
receive() external payable {}
function transfer(address to, uint256 amount) public returns (bool) {
require(to != address(0), "Zero address");
uint256 senderBalance = balanceOf[msg.sender];
require(senderBalance >= amount, "Insufficient balance");
unchecked {
balanceOf[msg.sender] = senderBalance - amount;
}
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function approve(address spender, uint256 amount) public returns (bool) {
require(spender != address(0), "Zero spender");
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public returns (bool) {
require(to != address(0), "Zero address");
uint256 fromBalance = balanceOf[from];
require(fromBalance >= amount, "Insufficient balance");
uint256 currentAllowance = allowance[from][msg.sender];
require(currentAllowance >= amount, "Insufficient allowance");
unchecked {
balanceOf[from] = fromBalance - amount;
allowance[from][msg.sender] = currentAllowance - amount;
}
balanceOf[to] += amount;
emit Transfer(from, to, amount);
emit Approval(from, msg.sender, allowance[from][msg.sender]);
return true;
}
function withdrawETH(uint256 amount) external onlyDeployer {
require(amount <= address(this).balance, "Insufficient ETH");
(bool success, ) = payable(deployer).call{value: amount}("");
require(success, "ETH transfer failed");
emit ETHRecovered(deployer, amount);
}
function withdrawToken(
address token,
uint256 amount
) external onlyDeployer {
require(token.code.length > 0, "Not a contract");
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(
IERC20Recovery.transfer.selector,
deployer,
amount
)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"Token transfer failed"
);
emit TokenRecovered(token, deployer, amount);
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.