ERC20 Upgradeable Initial Supply Issue

Deployed upgradeable ERC20, Proxy, and Admin based upon @abcoathup forum post for Upgradeable ERC20, token name, symbol, and supply were entered in 2_deployer_js script, I entered initial supply amount in the script to be 50,000 tokens, migrated it to live and only 0.0000.....5 tokens were actually deployed. And this seems to be because I should have added additional zeroes onto the 50,000 to account for ethereum number formatting standards....Am I correct in thinking this? Can I upgrade the contract to deploy the correct amount of tokens? I need to fix this as soon as possible @abcoathup

:computer: Environment

Truffle Upgrades 1.31, VSCode Wsl2,

:memo:Details

The upgraded ERC20 and migrations script did not deploy the correct amount of tokens. Nor did I notice any specific instructions regarding total supply input in js script.

:1234: Code to reproduce

2_deployment_script
const DAFI = artifacts.require('DaFi_ERC20_Upgrdbl');

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


module.exports = async function (deployer, accounts) {

    await deployProxy(DAFI, ['Da-Fi Token', 'DAFI', '50000'], { deployer, initializer: 'initialize' });
};

Solidity Contract

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.5;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";

import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";

contract DaFi_ERC20_Upgrdbl is Initializable, ERC20Upgradeable { 

    function initialize( string memory name, string memory symbol, uint256 initialSupply

    ) public virtual initializer {__ERC20_init(name, symbol);

        _mint(_msgSender(), initialSupply);

    }

}
1 Like

Yeah, the default decimals is 18, so if you want to set the total supply is 50000 token, it should be 5000 * 10 ** 18, as for how to upgrade the contract, you can have a look at this article: OpenZeppelin Upgrades: Step by Step Tutorial for Hardhat

1 Like

Thanks. I transferred ownership of the admin proxy into my gnosis safe. It then appears that I should be able to add a minter which would then allow me to mint the correct token amount, correct?

In terms of the total supply “formula” that you listed - do you mean that I can enter the exact sequence of numbers and operators you mentioned - 5000*10**18 directly into the java script migrations file in the exact location where I originally inputted 50000? Are you saying I wont have any issues with js or the compiler picking up the correct initial supply?

It baffles me that afer 10 years of innovations, upgrades, proxies, and now eth2 beacon chain that we still have to manually transform the initial supply to mesh with Ethereum…

1 Like

Hi @rmourey26,

You would need to upgrade to a new implementation contract which included the minting functionality to increase the supply, either as a one off or to allow further minting.