2018年 9月 14日の投稿一覧

Warning: Using contract member “balance” inherited from the address type is deprecated.

Solidityのバージョン変更でコンパイルエラー


contractAdminAddress.transfer( this.balance );

エラー全文


Warning: Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).balance" instead.

バージョン変更


- contractAdminAddress.transfer( this.balance );
+ contractAdminAddress.transfer( address( this ).balance );

Warning: Invoking events without “emit” prefix is deprecated.

solidityのバージョンを変えたらWarningがでるようになった。


- pragma solidity ^0.4.18;
+ pragma solidity ^0.4.24;

関数の呼び出しと、イベントの呼び出しを区別するためイベントの場合はemitが必要


Compilation warnings encountered:

/Users/dp/Dropbox/Ethereum/dappsTest/contracts/TestToken.sol:83:3: Warning: Invoking events without "emit" prefix is deprecated.
        Approval( msg.sender , _to , _tokenId );
        ^-------------------------------------^

emit Approval( msg.sender , _to , _tokenId );

https://github.com/ethereum/solidity/issues/2877