Files
smom-dbis-138/script/DeployUSDC.s.sol
2026-06-02 05:59:06 -07:00

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 USDC Token
* @notice ERC20 token with pausable and ownable features
* @dev Can be used as native USDC or wrapped USDC depending on deployment strategy
*/
contract StandardUSDC is ERC20, Ownable, Pausable {
uint8 private constant DECIMALS = 6; // USDC standard decimals
constructor(
address initialOwner,
uint256 initialSupply
) ERC20("USD Coin", "USDC") {
_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 DeployUSDC
* @notice Deployment script for USDC token
*/
contract DeployUSDC is Script {
function run() external {
address deployer = msg.sender;
address owner = vm.envOr("USDC_OWNER", deployer);
uint256 initialSupply = vm.envOr("USDC_INITIAL_SUPPLY", uint256(0));
console.log("Deploying USDC Token...");
console.log("Deployer:", vm.toString(deployer));
console.log("Owner:", vm.toString(owner));
console.log("Initial Supply:", initialSupply);
vm.startBroadcast();
StandardUSDC usdc = new StandardUSDC(owner, initialSupply);
vm.stopBroadcast();
console.log("USDC Token deployed at:", vm.toString(address(usdc)));
console.log("Name:", usdc.name());
console.log("Symbol:", usdc.symbol());
console.log("Decimals:", usdc.decimals());
console.log("Total Supply:", usdc.totalSupply());
}
}