Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
11

It should be a warning not an error. Anyway using this syntax function Inbox(string initialMessage) public { message = initialMessage; } is deprecated in the newer version of Solidity. You have to use constructor instead of the contract name constructor(string initialMessage) public { message = initialMessage; } this will compile without warnings


4

Try changing your pragmastatement to pragma solidity 0.4.16 (without the ^). There may be issues due to the pragma... statement, since with the ^, you allow version 0.4.16 or anything newer that does not break functionality (up to, but not including, version 0.5.0) (from solidity.readthedocs.io). This may lead to different byte code, resulting in a ...


4

You need to choose the right compiler version. On the right sidebar you can see your current compiler version. The compiler version must match the number used in the pragma solidity! Expand the dropdown and choose 0.5.12 nightly. You should probably downgrade to a full commit version like 0.5.11 commit. I hope this helps!


3

Just use constructor() should be good. constructor(string initialMessage) public { message = initialMessage; } If you use function constructor(...)... , I think you'll get the following warning: Warning: This function is named "constructor" but is not the constructor of the contract. If you intend this to be a constructor, use "constructor(...) ...


3

I agree with @gisdev_p, to a point. The carrot ^ symbol creates just the sort of ambiguity we don't want at this stage. Your contract is already deployed and, based on the source code, it may have been compiled with any Solidity compiler >= 0.4.16. Now, you need to discover the version of the compiler that was actually used to make the bytecode that's on ...


3

I think your function return argument should be renamed - this is what the compiler is really complaining about: function totalSupply() constant returns (uint256 something) { It's actually optional to name the return argument here; you can just put its type: function totalSupply() constant returns (uint) { [For future reference, it would be easier to ...


3

In general you can let a code run ignoring the compiler warnings. But it's always good not to do so. Most the time compiler warnings are warning you about something that may cause a bug in your code. Compared to compiler errors, the difference is your code is syntactically correct, hence can be compiled, but can lead to problems, specially when someone try ...


3

In order to deploy contract on MyEtherWallet, you need the bytecode. The bytecode contains the solidity pragma version in the metadata which is converted into the object parameter in the bytecode you get itself. It will compile using whatever is set as the pragma. As for verification. You will need to know what pragma was set in the solidity code itself. ...


3

This is because the method and the property have the same name. Since solidity automatically creates a public getter function for every public variable in the contract, you don't need function ownerInfo() public view returns (string)


3

SHORT ANSWER No, maybe with abstract contracts you can achieve something similar LONG ANSWER First of all to create an interface the keyword interface should be used (I used version 0.4.24 of solidity and the solidity documentation. I played a little bit with your code and when you try to create a function in an interface with a modifier, like this: ...


3

You can solve it by removing the word public from the mapping. The storage structure itself is acceptable and can be expected to work. However, the "free" getter for such a structure is not implemented in the compiler. It appears you are right about a breaking change, given that it compiles without complaint under 0.4.25. Possibly another kind soul will ...


2

Here is the discussion where it was decided to deprecate eth_compile. To summarize, it's not really geth's responsibility to compile code. Or parity's. Or any other node's. Continuing to support in-node compilation would force nodes to host compilers written in other languages. In addition, the interface to compile was poor, as there are many more ...


2

You can't pass the whole mapping. You could pass a struct internally. Ideally, you would enumerate the fields you really need to pass so you can create an interface that works with other contracts and clients. Your example above, seems to pass a single member of the source mapping. I would interpret that roughly like this: pragma solidity ^0.4.6; ...


2

In this case, the "strings" library only has functions with internal visibility therefore all the functions from the library are copied to the Contract contract therefore "strings" library was never deployed and so there isn't any placeholder to add the "strings" library address in the bytecode of Contract. To know why it was copied read this http://...


2

Even, I had the same error. From the Doc When using the Command Prompt on Windows, the default configuration file name can cause a conflict with the truffle executable.If this is the case, we recommend using Windows PowerShell or Git BASH as these shells do not have this conflict. Alternatively, you can rename the configuration file to truffle-config.js ...


2

Option 1 A typical fix and implementation of an ERC20 token is to rename the public variable to totalSupply (no underscore) and remove the function totalSupply as it would then be auto-generated by Solidity. Explanation of shadowing error message function totalSupply() constant returns (uint256 totalSupply) indicates to the compiler that the return value ...


2

Check your adblock. I think that's the issue. I also had the same problem today in Chrome, but when I tried it in Firefox (where I don't use adblocks) it works.


2

You're missing a ; after declaring what version of solidity you're using. Use this pragma solidity ^0.4.19; in the first line instead. Consider using remix IDE in the future to help solve these small errors. You can also use view on the getName function, this can be used as the function only reads data and will not cost Ether to run. Here is the updated ...


2

function ConstructorFunction(uint _inputOne, uint _inputTwo) public returns (bool success) { callAnotherFunction('string'); return true; } With summarized explanation: // describe the function i/o and visibility // input - types and optional variable name assigments function ConstructorFunction(uint _inputOne, uint _inputTwo) // visibility ...


2

You have missed the semicolon in the first line. It should be, pragma solidity ^0.4.6; I tried the code in Remix IDE and it compiles after the above correction.


2

pragma keyword in solidity has a ; at the end of the line. you've forgotten it. It should be like, pragma solidity ^0.4.6;


2

As other answers also have pointed, You just have missed the ; at the end of the very first line.


2

@Hari GTT Psicolabis' answer is right, but that means that you have to specify the ownerInfo field as public to get the benefit of a public getter. string public ownerInfo = "Contract Owner name XYZ"; the alternative, is to change the name of your function.


2

Thanks to @generalpiston in 0xproject's chat page: The notation is <character offset>:<length>:<something else> where everything can be reconstructed that way. 27:7:0 has no line numbers in it!


2

Typically revert will bubble-up and revert the whole transaction so you don't need to worry about incorrect return values - the whole transaction will fail. There is no way to catch this kind of exception and therefore no way to prevent it from happening if the code issues a revert. There are some minor exceptions to this rule, namely delegatecall and ...


2

This is probably an issue with Solidity compiler versions. You can find out which version of Solidity compiler is used by your local Truffle using this post. After that, I would advise you to set your compiler versions explicitly using Truffle configuration. When your AWS compiler is in sync with your local compiler, you should be good to go.


2

Truffle 4.1.14 relies on solc 0.4.24. Truffle 5.0.1 relies on solc 0.5.0. Between these two versions of solc there are breaking changes, meaning that you're very much likely to get compilation errors in the latter, which you have not received in the former. If you don't want to update your contracts to solc 0.5.x, but still be able to compile them with ...


2

I found that OpenZeppelin seems to silence such compiler warnings about state mutability in this way: function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } This snippet is from there Context.sol ...


1

Go to node_modules -> solc -> package.json -> version of your compiler can be found at the bottom. Never edit the package.json file To fix the problem -Copy the version number at the bottom ex:-"version": "0.5.1" -go to your contract and paste on pragma. ex:- pragma solidity ^0.5.1; This should fix your issue.


1

[Solved] Thank you Juan Blanco for his advice. So the main issue is that the forked extension(Solidity Extended by beaugunderson) was highjacking this one(solidity by Juan Blanco) hence I had the old version of the compiler 0.4.17 but not the latest version 0.4.23.


Only top voted, non community-wiki answers of a minimum length are eligible