Change name of deployed erc20 token

I have been working on erc20 contract with the support of openzeppelin erc20 contracts . One thing I am trying to do is to have the ability to change basic details of contract like contract name or contract symbol after it is deployed for admins . I have successfully implemented access controls but I am unable to change details . Here is basic function which I wrote

  function changename(string memory name) public onlyadmin{
    	    	name = name;


but it doesn’t change contract name.
Anyone can help me what mistake I am doing ?

1 Like

Hi @Mohammad_Obaid,

Welcome to the community :wave:

I would be cautious about changing things such as token name as users may not expect this to change. (Though changing the name isn’t prohibited in the EIP).
I would recommend being clear with users under what circumstances these changes would occur.
Also suggest checking what support there is for name changing, e.g. Etherscan didn’t display my name change.

With regards changing the name:
_name is a private state variable in ERC20Detailed
The name function returns the value of _name in ERC20Detailed

A possible implementation would involve overriding the name function.

I deployed the following sample token contract using Remix to Kovan.
Though Etherscan didn’t pick up the change in name.

pragma solidity ^0.5.0;

import "";
import "";
import "";

contract Token is ERC20, ERC20Detailed, Ownable {

    string private _name;
    event NameChanged(string newName, address by);

    constructor () public ERC20Detailed("Token", "TKN", 18) {
        _mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
    function changeName(string memory name) public onlyOwner{
        _name = name;
        emit NameChanged(name, msg.sender);
    function name() public view returns (string memory) {
        return _name;

Hi @Mohammad_Obaid,

I wanted to check if you needed more information, or the above reply resolved your question?