MockUSDT.sol 1012 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.24;
  3. import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
  4. import "@openzeppelin/contracts/access/Ownable.sol";
  5. /**
  6. * @title MockUSD1
  7. * @dev Mock USD1 token for testing purposes
  8. */
  9. contract MockUSD1 is ERC20, Ownable {
  10. uint8 private _decimals = 18; // Standard ERC20 has 18 decimals
  11. constructor() ERC20("Mock USD1", "mUSD1") Ownable(msg.sender) {
  12. // Mint initial supply to deployer
  13. _mint(msg.sender, 1000000 * 10**18); // 1M USD1
  14. }
  15. /**
  16. * @dev Returns the number of decimals used to get its user representation.
  17. */
  18. function decimals() public view virtual override returns (uint8) {
  19. return _decimals;
  20. }
  21. /**
  22. * @dev Mint tokens to a specific address (only owner)
  23. */
  24. function mint(address to, uint256 amount) public onlyOwner {
  25. _mint(to, amount);
  26. }
  27. /**
  28. * @dev Burn tokens from caller
  29. */
  30. function burn(uint256 amount) public {
  31. _burn(msg.sender, amount);
  32. }
  33. }