# Token erc20 with specified contract owner

**URL:** <https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401>\
**Category:** Contracts\
**Created:** [March 13, 2019, 6:54pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401 "2019-03-13T18:54:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mssmx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mssmx/32/345_2.png) [@mssmx](https://forum.openzeppelin.com/u/mssmx)\
**Post date:** [March 13, 2019, 6:54pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/1 "2019-03-13T18:54:27Z")

</div>

hello  
i want to create a standard erc20 token but i would like to specify a public address as contract owner instead of the address signing the transaction of contract creation.  
Is this possible? how can i do this?  
thanks  
Massimo

---

<div class="post-metadata">

**Author:** ![nventuro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nventuro/32/8_2.png) [@nventuro](https://forum.openzeppelin.com/u/nventuro)\
**Post date:** [March 13, 2019, 7:29pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/2 "2019-03-13T19:29:47Z")

</div>

Hello @mssmx, welcome to the forum!

OpenZeppelin’s `ERC20` contract has no owner to speak of, perhaps you’re referring to one of its variants, such as `ERC20Mintable`? In those cases, there are `internal` functions that you could call in your constructor to achieve the result you want. Perhaps you could share some code so we can better help you?

Again, welcome! Check out the [intros thread](https://forum.openzeppelin.com/t/introduce-yourself-here/88) and tell us a bit about you. 🙂

---

<div class="post-metadata">

**Author:** ![mssmx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mssmx/32/345_2.png) [@mssmx](https://forum.openzeppelin.com/u/mssmx)\
**Post date:** [March 14, 2019, 5:39am UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/3 "2019-03-14T05:39:18Z")

</div>

thank you for reply. at the moment i am referring to standard erc20. i know that there is no owner, but normally the signer of the contract creation transaction (msg.sender) is the “creator” which will receive the full amount. In my very simple case, i would like to specify a different address where to send all the tokens at creation time but this address does not belong to the msg.sender. please see below the code. is this ok on your opinion from that point of view?

```
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
        string public name ;
        string public symbol;
        uint public decimals;
        uint private INITIAL_SUPPLY;

        constructor(
            string memory tokenName,
            string memory tokenSymbol,
            uint256 tokenDecimals,
            uint256 initialSupply,
            address tokenOwner
            ) public {
                name=tokenName;
                symbol=tokenSymbol;
                decimals=tokenDecimals;
                INITIAL_SUPPLY = initialSupply * (10 ** decimals);
		// send all the supply to tokenOwner
                _mint(tokenOwner,INITIAL_SUPPLY);
        }

}
```

---

<div class="post-metadata">

**Author:** ![mssmx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mssmx/32/345_2.png) [@mssmx](https://forum.openzeppelin.com/u/mssmx)\
**Post date:** [March 14, 2019, 6:18pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/4 "2019-03-14T18:18:26Z")

</div>

@nventuro do you have a suggestion about above?

---

<div class="post-metadata">

**Author:** ![IvanTheGreatDev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ivanthegreatdev/32/6647_2.png) [@IvanTheGreatDev](https://forum.openzeppelin.com/u/IvanTheGreatDev)\
**Post date:** [March 14, 2019, 8:57pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/5 "2019-03-14T20:57:41Z")

</div>

Hello @mssmx! No need to tag nventuro 🙂 he should be notified on replies.

As for the code you put, it seems fine for your needs! There’s no need to make INITIAL\_SUPPLY a global variable though, you can just use it as totalSupply.

---

<div class="post-metadata">

**Author:** ![mssmx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mssmx/32/345_2.png) [@mssmx](https://forum.openzeppelin.com/u/mssmx)\
**Post date:** [March 15, 2019, 5:24am UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/6 "2019-03-15T05:24:18Z")

</div>

ok Ivan thank you. sorry for unuseful tagging

---

<div class="post-metadata">

**Author:** ![nventuro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nventuro/32/8_2.png) [@nventuro](https://forum.openzeppelin.com/u/nventuro)\
**Post date:** [March 15, 2019, 3:55pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/7 "2019-03-15T15:55:13Z")

</div>

Ah, I see what you mean. In your case, if you already know the address, you can simply include it in the constructor as a hard-coded value:

```auto
constructor() public {
  // replace below with intended recipient address
  _mint(0x36Fe25e27F640a8635Ba8f0F10F3eadFDf5bC04a, INITIAL_SUPPLY);
}

```

Alternatively, for a more flexible solution you could pass it as an argument:

```auto
constructor(address initialHolder) public {
  _mint(initialHolder, INITIAL_SUPPLY);
}

```

Finally, you can also inherit from `ERC20Detailed`, and make managing `name`, etc. easier that way 🙂

```auto
contract is ERC20, ERC20Detailed {
  constructor(
    address initialHolder,
     string memory name, 
     string memory symbol, 
     uint8 decimals)
  ERC20Detailed(name, string, decimals) 
  public {
    _mint(initialHolder, INITIAL_SUPPLY);
  }
}

```

---

<div class="post-metadata">

**Author:** ![mssmx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mssmx/32/345_2.png) [@mssmx](https://forum.openzeppelin.com/u/mssmx)\
**Post date:** [March 15, 2019, 6:41pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/8 "2019-03-15T18:41:51Z")

</div>

thank you! I used your last suggestion and all assembled i got this:

```auto
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";

contract MyToken is ERC20, ERC20Detailed {
  constructor(
    address initialHolder,
     string memory name, 
     string memory symbol,
    uint256 initialSupply,
     uint8 decimals)
  ERC20Detailed(name, symbol , decimals) 
  public {
    _mint(initialHolder, initialSupply * (10 ** uint256(decimals)));
  }
}

```

it seems working. i pass all the details as arguments. am i ok?

---

<div class="post-metadata">

**Author:** ![nventuro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nventuro/32/8_2.png) [@nventuro](https://forum.openzeppelin.com/u/nventuro)\
**Post date:** [March 18, 2019, 4:16pm UTC](https://forum.openzeppelin.com/t/token-erc20-with-specified-contract-owner/401/9 "2019-03-18T16:16:11Z")

</div>

> [@mssmx](#):
>
> it seems working. i pass all the details as arguments. am i ok?

Yes, your example looks great 🙂
