Openzeppelin-contracts: Warnings for this.balance in contracts since 0.4.21

Created on 1 Apr 2018  路  4Comments  路  Source: OpenZeppelin/openzeppelin-contracts

馃帀 Description

wallet.transfer(this.balance); throws a warning: "Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member."

  • [x] 馃悰 This is a bug report.
  • [ ] 馃搱 This is a feature request.
good first issue

Most helpful comment

I solved it the way @Shrugs mentioned. It wasn't a problem for me, I was just informing the community about it in case someone else runs across it. Easy fix. But I was using compiler version 0.4.18 or 21

All 4 comments

The solution to this is probably to change line https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/crowdsale/distribution/utils/RefundVault.sol#L47 to

wallet.transfer(address(this).balance);

Because .balance is a property of the address type, not the Contract type.

@shyheim103 which compiler version are you using?

This warning is showing up since Solidity 0.4.21. It comes up in Travis after #876.

I solved it the way @Shrugs mentioned. It wasn't a problem for me, I was just informing the community about it in case someone else runs across it. Easy fix. But I was using compiler version 0.4.18 or 21

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebastien-kr picture sebastien-kr  路  4Comments

valmack picture valmack  路  3Comments

rstormsf picture rstormsf  路  4Comments

bsadeh picture bsadeh  路  4Comments

LogvinovLeon picture LogvinovLeon  路  4Comments