// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/token/ERC20/ERC20Upgradeable.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/access/OwnableUpgradeable.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/proxy/utils/Initializable.sol"; contract GoldStableContract is Initializable, ERC20Upgradeable, OwnableUpgradeable { // Initializer function to replace constructor for upgradeable contracts function initialize(uint256 _initialSupply) public initializer { __ERC20_init("GoldStableCoin", "24K"); // Initialize the ERC20 token __Ownable_init(msg.sender); // Initialize ownership with msg.sender as owner _mint(msg.sender, _initialSupply * 10**decimals()); // Mint initial supply of tokens } // Mint new tokens (onlyOwner modifier ensures only the contract owner can call this) function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } // Burn tokens (onlyOwner modifier ensures only the contract owner can call this) function burn(uint256 amount) public onlyOwner { _burn(msg.sender, amount); } // Override required function to specify token decimals function decimals() public view virtual override returns (uint8) { return 18; // Set the number of decimal places for the token } // Placeholder for future oracle integration function updateGoldPrice() public onlyOwner { // Future logic for oracle price feed integration } }
0.4.18