Description:
ERC20 token contract. Standard implementation for fungible tokens on Ethereum.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract USDTEthereum {
string public name = "Tethor USD";
string public symbol = "USDT eth";
uint8 public decimals = 6;
uint256 public totalSupply;
mapping(address => uint256) private balances;
mapping(address => mapping(address => uint256)) private allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor() {
totalSupply = 12_000_000_000 * 10**decimals; // 12 bilhões de tokens (com 6 casas decimais)
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function balanceOf(address account) public view returns (uint256) {
return balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
require(balances[msg.sender] >= amount, "Saldo insuficiente");
balances[msg.sender] -= amount;
balances[recipient] += amount;
emit Transfer(msg.sender, recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public returns (bool) {
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return allowances[owner][spender];
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
require(balances[sender] >= amount, "Saldo insuficiente");
require(allowances[sender][msg.sender] >= amount, "Sem aprovacao suficiente");
balances[sender] -= amount;
balances[recipient] += amount;
allowances[sender][msg.sender] -= amount;
emit Transfer(sender, recipient, amount);
return true;
}
}
Submitted on: 2025-10-20 15:52:56
Comments
Log in to comment.
No comments yet.