8

browser/ballot.sol:61:13: Warning: Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member. require(this.balance >= 1000000000000000);

What does it mean "convert the contract to address" type? How do I get the address of this?

I got this error in 0.4.21 of Solidity through Remix browser.

15

Try require(address(this).balance >= 1000000000000000)

2

Just assign 'this' to a local variable

address myAddress = this;
require(myAddress.balance >= 1000000000000000);
0

using

address(this).balance 

is the correct approach

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.