Hello OpenZeppelin Community,
Me and my friends are currently learning about Cryptocurrency Contract Creation while also implementing it directly on the Ethereum Blockchain for future uses for our Thesis.
We're planning to create the contract using the Contracts Wizard with the following code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
/// @custom:security-contact welearn@gmail.com
contract WeLearn is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, PausableUpgradeable, AccessControlUpgradeable, ERC20PermitUpgradeable {
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function initialize() initializer public {
__ERC20_init("WeLearn", "WLRN");
__ERC20Burnable_init();
__Pausable_init();
__AccessControl_init();
__ERC20Permit_init("WeLearn");
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
}
function pause() public onlyRole(PAUSER_ROLE) {
_pause();
}
function unpause() public onlyRole(PAUSER_ROLE) {
_unpause();
}
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
_mint(to, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
whenNotPaused
override
{
super._beforeTokenTransfer(from, to, amount);
}
}
We will then be using the https://remix.ethereum.org/ to compile and deploy the contract via their compiler 0.8.9
Now my question would be the following before we spend our money deploying this,
- Will I, as the contract deployer, be able to allow certain addresses to Mint and Burn tokens via the Roles? And how will they be able to Mint and Burn tokens?
- If ever in the future we need to change something in the contract, will we be able to do it without deploying it again? Or how does this upgradeable works?
- Will they be able to mint and burn tokens without paying gas fees due to the Permit role?
We're still in the learning curve and are currently reading out through the Documents libraries but it seems a bit more complicated for us to understand some parts of it so we would like to ask directly.
Thank you so much for helping.