dmdv
January 21, 2021, 1:04pm
1
This is initialize
function of my upgradeable contract
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
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
How are you checking symbol
, name
and totalSupply
?
dmdv
January 21, 2021, 3:24pm
3
I check in contract data in https://rinkeby.etherscan.io
And by events
And how are you picking the address to which call totalSupply()
? Maybe you’re using the implementation instead of the proxy address?
dmdv
January 21, 2021, 3:35pm
5
I can see it in my address transaction in etherscan and also during deployment there’s an output with contracts name and address
dmdv
January 21, 2021, 3:41pm
6
Perhaps, I should look at AdminUpgradeabilityProxy?
dmdv
January 21, 2021, 5:05pm
7
My address: https://rinkeby.etherscan.io/address/0x860fa46f170a87df44d7bb867aa4a5d2813127c1
Last 4 transactions for contracts:
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 (AdminUpgradeabilityProxy)
https://rinkeby.etherscan.io/address/0x857411020c5e2b540fdd6c5ed0a4faeb678ef280 (ProxyAdmin)
https://rinkeby.etherscan.io/address/0x2e4cd3fd7ed77a278d118b95e4bef5b7079367da (implementation)
Token:
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.
Hi @dmdv ,
Etherscan shows your token name, symbol and decimals.
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.
dmdv
January 21, 2021, 7:53pm
9
@abcoathup I don’t understand, this is the token contracts:
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
1 Like
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?
1 Like
dmdv
January 22, 2021, 5:42pm
11
@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
1 Like
Hi @dmdv ,
It looks like decoding logs with proxy contracts isn’t supported by Etherscan:
opened 10:44AM - 13 Jan 21 UTC
closed 12:45PM - 18 Jan 21 UTC
We deployed my smart contract with truffle-upgrades and looks like Etherscan can't decode any event logs after that. When deploying without...
1 Like