0

I cant call me a pro at all. Rather newbie than pro, wishing to learn and develop. I`m sincerely asking you to help me.

I have the token and crowdsale contract (testing) which I deploy and initialize using solidity ^0.4.20 without any issues. But in the REMIX I have an exclamation mark there like this:

Warning: Function state mutability can be restricted to pure function finalization() internal { ^ Spanning multiple lines.

No matter of what it still works fine (include finalization step).

But when I try to compile it with solidity ^0.4.21

(after adding emit and some changes in ...............(this.balance); to ...........(myAddress.balance); with adding additional string above: address myAddress = this;) - to remove all exclamation marks (except finalization())

Token deploys fine but the crowdsale contract gives me an error:

"Error: gas required exceeds allowance or always failing transaction"

Seems that its not enought just to make this changes (above). Did I miss anything?. + Could this finalization() warning exclamation mark affect and breake everything in 4.21?

I saw people help each other here and it works very effective. So I decided to post my question as well.

Thank you in advance.

4
  • Need the full code. May 22, 2018 at 6:50
  • Please show your source code to be able to help.
    – Jaime
    May 22, 2018 at 7:05
  • This question is a mess! Consider positing the entire contract (or at least a "consecutive chunk") instead of those little fragments of code. May 22, 2018 at 8:37
  • Remix has a default value of 3M gas, if your crowdsale is larger it will fail, in the "Run" tab there's a "Gas Limit" option that allows to set a larger value.
    – Ismael
    May 22, 2018 at 12:45

1 Answer 1

1

You should use address(this).balance to cast this to the address type instead of adding one more variable.

Maybe this will help, if no - provide the full source of your contract please.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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