Skip to content

Commit

Permalink
make token name/symbol changeable
Browse files Browse the repository at this point in the history
  • Loading branch information
JonahGroendal committed Sep 30, 2022
1 parent 09dd00e commit 9ff1a08
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions contracts/Token.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ contract Token is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, Acc
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");

event NameChanged(string newName, address by);
event SymbolChanged(string newSymbol, address by);

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
Expand All @@ -51,6 +54,16 @@ contract Token is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, Acc
_mint(to, amount);
}

function changeName(string memory name) public onlyRole(UPGRADER_ROLE){
_name = name;
emit NameChanged(name, msg.sender);
}

function changeSymbol(string memory symbol) public onlyRole(UPGRADER_ROLE){
_symbol = symbol;
emit SymbolChanged(symbol, msg.sender);
}

function _authorizeUpgrade(address newImplementation)
internal
onlyRole(UPGRADER_ROLE)
Expand Down

0 comments on commit 9ff1a08

Please sign in to comment.