关于solidity 0.5.0中的transfer的修改:
官方中原话:
- The
address
type was split intoaddress
andaddress payable
, where onlyaddress payable
provides thetransfer
function. Anaddress payable
can be directly converted to anaddress
, but the other way around is not allowed. Convertingaddress
toaddress payable
is possible via conversion throughuint160
. Ifc
is a contract,address(c)
results inaddress payable
only ifc
has a payable fallback function. If you use the withdraw pattern, you most likely do not have to change your code becausetransfer
is only used onmsg.sender
instead of stored addresses andmsg.sender
is anaddress payable
.
意思就是 address分成了两个部分,一个是address 一个是address payable ,如果你用address 在交易方面的话,你要定义address 变量,需要在address后加payable。例如:address payable neederAddress;
不知道解释的明白不,下面是官方api 不懂的话你们自己看下。我也一个刚学区块链的小白。请大家多多指教。
https://solidity.readthedocs.io/en/v0.5.3/050-breaking-changes.html?highlight=address%20payable