102 lines
2.8 KiB
Solidity
102 lines
2.8 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.19;
|
|
|
|
import {Script} from "forge-std/Script.sol";
|
|
import {console} from "forge-std/console.sol";
|
|
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
import "@openzeppelin/contracts/access/Ownable.sol";
|
|
import "@openzeppelin/contracts/security/Pausable.sol";
|
|
|
|
/**
|
|
* @title Standard USDT Token
|
|
* @notice ERC20 token with pausable and ownable features
|
|
* @dev Can be used as native USDT or wrapped USDT depending on deployment strategy
|
|
*/
|
|
contract StandardUSDT is ERC20, Ownable, Pausable {
|
|
uint8 private constant DECIMALS = 6; // USDT standard decimals
|
|
|
|
constructor(
|
|
address initialOwner,
|
|
uint256 initialSupply
|
|
) ERC20("Tether USD", "USDT") {
|
|
_transferOwnership(initialOwner);
|
|
if (initialSupply > 0) {
|
|
_mint(initialOwner, initialSupply);
|
|
}
|
|
}
|
|
|
|
function decimals() public pure override returns (uint8) {
|
|
return DECIMALS;
|
|
}
|
|
|
|
/**
|
|
* @notice Mint new tokens (only owner)
|
|
* @param to Address to mint to
|
|
* @param amount Amount to mint
|
|
*/
|
|
function mint(address to, uint256 amount) external onlyOwner {
|
|
_mint(to, amount);
|
|
}
|
|
|
|
/**
|
|
* @notice Burn tokens (only owner)
|
|
* @param from Address to burn from
|
|
* @param amount Amount to burn
|
|
*/
|
|
function burn(address from, uint256 amount) external onlyOwner {
|
|
_burn(from, amount);
|
|
}
|
|
|
|
/**
|
|
* @notice Pause token transfers (only owner)
|
|
*/
|
|
function pause() external onlyOwner {
|
|
_pause();
|
|
}
|
|
|
|
/**
|
|
* @notice Unpause token transfers (only owner)
|
|
*/
|
|
function unpause() external onlyOwner {
|
|
_unpause();
|
|
}
|
|
|
|
function _beforeTokenTransfer(
|
|
address from,
|
|
address to,
|
|
uint256 amount
|
|
) internal override whenNotPaused {
|
|
super._beforeTokenTransfer(from, to, amount);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @title DeployUSDT
|
|
* @notice Deployment script for USDT token
|
|
*/
|
|
contract DeployUSDT is Script {
|
|
function run() external {
|
|
address deployer = msg.sender;
|
|
address owner = vm.envOr("USDT_OWNER", deployer);
|
|
uint256 initialSupply = vm.envOr("USDT_INITIAL_SUPPLY", uint256(0));
|
|
|
|
console.log("Deploying USDT Token...");
|
|
console.log("Deployer:", vm.toString(deployer));
|
|
console.log("Owner:", vm.toString(owner));
|
|
console.log("Initial Supply:", initialSupply);
|
|
|
|
vm.startBroadcast();
|
|
|
|
StandardUSDT usdt = new StandardUSDT(owner, initialSupply);
|
|
|
|
vm.stopBroadcast();
|
|
|
|
console.log("USDT Token deployed at:", vm.toString(address(usdt)));
|
|
console.log("Name:", usdt.name());
|
|
console.log("Symbol:", usdt.symbol());
|
|
console.log("Decimals:", usdt.decimals());
|
|
console.log("Total Supply:", usdt.totalSupply());
|
|
}
|
|
}
|
|
|