0

Why do i ask this? I've been trying to solve this for hours.

Problem version 1:

Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.function TokenERC20(

 */
function TokenERC20( 
    uint256 initialSupply,
    string tokenName,
    string tokenSymbol

Version 2

browser/Test.sol:187:6: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.

/* Initializes contract with initial supply tokens to the creator of the contract */
 function MyAdvancedToken(
    uint256 initialSupply,
    string tokenName,
    string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}

2 Answers2

1

Listen to your warning!

constructor(
    ...
    ...

Its a new solidity thing...the argument that has the same name as the Contract no longer works, you have to use 'constructor'

thefett
  • 3,873
  • 5
  • 26
  • 48
  • I've been doing that for hours now, no kidding, but I just keep getting this constructor TokenERC20( error lines as this one constructor MyAdvancedToken( : browser/Test.sol:187:21: ParserError: Expected token LParen got 'Identifier' constructor MyAdvancedToken( – Crypto Offical May 09 '18 at 01:46
0

These both codes, does seem to be annoying. I've been doing exactly that, but it just won't work. It seems alike that there's something that i Should now here.

*/ function TokenERC20( uint256 initialSupply, string tokenName, string tokenSymbol

function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol

enter image description here

browser/Test.sol:45:28: ParserError: Expected token Semicolon got 'LParen' Constructors TokenERC20(

enter image description here

enter image description here

  • the keyword is constructor, and you have to remove the contract name (in your case TokenERC20) please check this answer https://ethereum.stackexchange.com/questions/45972/ive-got-an-error-while-compiling-use-constructor-instead/45973#45973 – qbsp May 09 '18 at 02:30