Home > Blockchain >  Solidity0.5.0 + solution transfer payable
Solidity0.5.0 + solution transfer payable

Time:09-23

//the author for the first time, panic,
Question:
Practice writing the raise contract, meet transfer error
TypeError: Member "transfer" not found or not visible after argument - dependent lookup in the address.
Issue to explore:
0.5.0 version used in the transfer method, the use of transfer account address must be declared payable
Note: not function declarations payable, but the address
The solution:
Case 1
If the address is incoming again after deployment, namely the function does not automatically get the address, in need at this time:
The function name (address payable youraddress) public payable {}
Case 2
If the address is derived from the struct is then stored on block chain,
Now need to:
Struct structname {
Address payable youraddress;
}
Went on a map and a pile of operation after the address into whoaddress
Address call:
Address payable account=whoaddress;
The transfer (wei) x
//this function does not need payable
  • Related