# Initialize function is not invoked during deployment of upgradeable contract

**URL:** <https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503>\
**Category:** Upgrades\
**Tags:** proxies\
**Created:** [January 21, 2021, 1:04pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503 "2021-01-21T13:04:50Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 21, 2021, 1:04pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/1 "2021-01-21T13:04:50Z")

</div>

This is `initialize` function of my upgradeable contract

```auto
contract MyContract is
     Initializable,
     ERC20PresetMinterPauserUpgradeable,
     OwnableUpgradeable
{
    function initialize(string memory _name, string memory _symbol)
        public
        override
        initializer
    {
        emit ContractInitStarted(_name, _symbol, msg.sender, block.timestamp);
        __ERC20PresetMinterPauser_init(_name, _symbol);
        __Ownable_init_unchained();
        _mint(msg.sender, 500000000 ether);
        emit ContractInitEnded(_name, _symbol, msg.sender, block.timestamp);
    }
}

```

This is `2_deploy_contracts.js`

```auto
const MyContract = artifacts.require("./MyContract .sol");

const { deployProxy } = require("@openzeppelin/truffle-upgrades");

module.exports = async function (deployer) {
  await deployProxy(MyContract , ["MyContract 1.0", "TenX"], { deployer, initializer: "initialize" });
};

```

`npx truffle deploy --network rinkeby`

Initialize function is never invoked.  
symbol, name and totalSupply are empty

---

<div class="post-metadata">

**Author:** ![martriay](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/martriay/32/20_2.png) [@martriay](https://forum.openzeppelin.com/u/martriay)\
**Post date:** [January 21, 2021, 3:12pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/2 "2021-01-21T15:12:44Z")

</div>

How are you checking `symbol`, `name` and `totalSupply`?

---

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 21, 2021, 3:24pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/3 "2021-01-21T15:24:09Z")

</div>

I check in contract data in [https://rinkeby.etherscan.io](https://rinkeby.etherscan.io)  
And by events

---

<div class="post-metadata">

**Author:** ![martriay](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/martriay/32/20_2.png) [@martriay](https://forum.openzeppelin.com/u/martriay)\
**Post date:** [January 21, 2021, 3:25pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/4 "2021-01-21T15:25:16Z")

</div>

And how are you picking the address to which call `totalSupply()`? Maybe you’re using the implementation instead of the proxy address?

---

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 21, 2021, 3:35pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/5 "2021-01-21T15:35:07Z")

</div>

I can see it in my address transaction in etherscan and also during deployment there’s an output with contracts name and address

---

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 21, 2021, 3:41pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/6 "2021-01-21T15:41:38Z")

</div>

Perhaps, I should look at AdminUpgradeabilityProxy?

---

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 21, 2021, 5:05pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/7 "2021-01-21T17:05:34Z")

</div>

My address: [https://rinkeby.etherscan.io/address/0x860fa46f170a87df44d7bb867aa4a5d2813127c1](https://rinkeby.etherscan.io/address/0x860fa46f170a87df44d7bb867aa4a5d2813127c1)

Last 4 transactions for contracts:

> **[Contract Address 0x6f8dc56c88112cdaedee8610bdb5caf601c145de | Etherscan](https://rinkeby.etherscan.io/address/0x6f8dc56c88112cdaedee8610bdb5caf601c145de)**
>
> The Contract Address 0x6f8dc56c88112cdaedee8610bdb5caf601c145de page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

[https://rinkeby.etherscan.io/address/0xe97ef53dd413729425317a768a0ba425831c5107](https://rinkeby.etherscan.io/address/0xe97ef53dd413729425317a768a0ba425831c5107) (AdminUpgradeabilityProxy)

[https://rinkeby.etherscan.io/address/0x857411020c5e2b540fdd6c5ed0a4faeb678ef280](https://rinkeby.etherscan.io/address/0x857411020c5e2b540fdd6c5ed0a4faeb678ef280) (ProxyAdmin)

[https://rinkeby.etherscan.io/address/0x2e4cd3fd7ed77a278d118b95e4bef5b7079367da](https://rinkeby.etherscan.io/address/0x2e4cd3fd7ed77a278d118b95e4bef5b7079367da) (implementation)

Token:

> **[MyToken Token 1.0 (TenX) Token Tracker | Etherscan](https://rinkeby.etherscan.io/token/0xe97ef53dd413729425317a768a0ba425831c5107)**
>
> MyToken Token 1.0 (TenX) Token Tracker on Etherscan shows the price of the Token $0.0000, total supply 500,000,000, number of holders 1 and updated information of the token. The token tracker page also shows the analytics and historical data.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [January 21, 2021, 7:47pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/8 "2021-01-21T19:47:46Z")

</div>

Hi @dmdv,

Etherscan shows your token name, symbol and decimals.

> **[MyToken Token 1.0 (TenX) Token Tracker | Etherscan](https://rinkeby.etherscan.io/token/0xe97ef53dd413729425317a768a0ba425831c5107)**
>
> MyToken Token 1.0 (TenX) Token Tracker on Etherscan shows the price of the Token $0.0000, total supply 500,000,000, number of holders 1 and updated information of the token. The token tracker page also shows the analytics and historical data.

If you verify your implementation contract you can interact via Etherscan.

> **[And Finally…. Proxy Contract Support on Etherscan.](https://medium.com/etherscan-blog/and-finally-proxy-contract-support-on-etherscan-693e3da0714b?source=linkShare-3b0c0066557a-1611258381&_branch_match_id=880888725321414015)**
>
> On Etherscan, interacting with upgradeable contracts using a proxy standard was a real pain point. Some of you may find the below issues…

---

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 21, 2021, 7:53pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/9 "2021-01-21T19:53:41Z")

</div>

@abcoathup I don’t understand, this is the token contracts:

> **[Contract Address 0xe97ef53dd413729425317a768a0ba425831c5107 | Etherscan](https://rinkeby.etherscan.io/address/0xe97ef53dd413729425317a768a0ba425831c5107#code)**
>
> The Contract Address 0xe97ef53dd413729425317a768a0ba425831c5107 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

And this is **AdminUpgradeabilityProxy**

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [January 22, 2021, 2:58am UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/10 "2021-01-22T02:58:45Z")

</div>

Hi @dmdv,

With upgradeable contracts, we interact with the proxy and not with the implementation contract, or to put it another way, we use the ABI of the implementation contract to interact with the proxy at the address of the proxy.

The proxy contract on Etherscan shows the name, symbol, decimal etc as I would expect.

I am not sure what the issue is?

---

<div class="post-metadata">

**Author:** ![dmdv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dmdv/32/3862_2.png) [@dmdv](https://forum.openzeppelin.com/u/dmdv)\
**Post date:** [January 22, 2021, 5:42pm UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/11 "2021-01-22T17:42:13Z")

</div>

@abcoathup I followed the instruction you’d posted before and it worked. Thanks.  
But the question is still there - why I couldn’t see any events from initialize function

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [January 25, 2021, 7:20am UTC](https://forum.openzeppelin.com/t/initialize-function-is-not-invoked-during-deployment-of-upgradeable-contract/5503/12 "2021-01-25T07:20:59Z")

</div>

Hi @dmdv,

It looks like decoding logs with proxy contracts isn’t supported by Etherscan:

> <https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/281>
>
> We deployed my smart contract with truffle-upgrades and looks like Etherscan can't decode any event logs after that. When deploying without...
