When i try to run migration from truffle, i got this problem, here my contract code:

pragma solidity ^0.5.0;

  contract DappToken {

    uint256 public totalSupply;

    function DappToken () public {
        totalSupply = 1000000;

And I got this message on cmd window, seem there are many more issue, so if you guy could help me out, i really appreaciated.

This declaration shadows an existing declaration.

PS: for more infomation, I follow the instruction video "Code Your Own Cryptocurrency on Ethereum (Full)" from Dapp University chanel on youtube , at 37:40

1 Answer 1


Since the version 0.4.22 of Solidity, the constructor isn't the contract's name anymore but constructor.

Read more here.

  • I try again and change the name of function, it's work, thanks !
    – johnho.91
    Apr 13, 2019 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.