55 lines
1.6 KiB
Solidity
55 lines
1.6 KiB
Solidity
// SPDX-License-Identifier: MIT
|
||
pragma solidity ^0.8.0;
|
||
|
||
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
|
||
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
||
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
||
|
||
/**
|
||
* @title WUSD
|
||
* @notice Wrapped USD - 简单的ERC20代币
|
||
*/
|
||
contract WUSD is Initializable, ERC20Upgradeable, UUPSUpgradeable, OwnableUpgradeable {
|
||
|
||
/**
|
||
* @notice 初始化合约
|
||
* @param _name 代币名称
|
||
* @param _symbol 代币符号
|
||
*/
|
||
function initialize(string memory _name, string memory _symbol) external initializer {
|
||
__ERC20_init(_name, _symbol);
|
||
__UUPSUpgradeable_init();
|
||
__Ownable_init(msg.sender);
|
||
}
|
||
|
||
/**
|
||
* @notice 授权升级(仅owner可调用)
|
||
* @param newImplementation 新实现合约地址
|
||
*/
|
||
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
||
|
||
/**
|
||
* @notice 铸造代币
|
||
* @param _to 接收地址
|
||
* @param _amount 铸造数量
|
||
*/
|
||
function mint(address _to, uint256 _amount) external onlyOwner {
|
||
_mint(_to, _amount);
|
||
}
|
||
|
||
/**
|
||
* @notice 销毁代币
|
||
* @param _from 销毁地址
|
||
* @param _amount 销毁数量
|
||
*/
|
||
function burn(address _from, uint256 _amount) external onlyOwner {
|
||
_burn(_from, _amount);
|
||
}
|
||
|
||
/**
|
||
* @dev 预留存储空间,用于未来升级时添加新的状态变量
|
||
*/
|
||
uint256[50] private __gap;
|
||
}
|