I'd like get ether balance of account in solidity. I tried the following, but it didn't work. Could you tell me how to do it?
contract MultiplyContract{
address public buyer;
address public seller;
uint public price;
function MultiplyContract(
address _buyer,
address _seller,
uint _price,
){
buyer = _buyer;
seller = _seller;
price = _price;
}
function Execution (address _buyer, address _seller) {
eth.getBalance(_buyer) -= price;
eth.getBalance(_seller) += price;
}
}
transferinstead. – Ender Aug 13 '19 at 04:06transferwas added later on, and yes it is safer in most cases. It is also important to be aware of cases where a contract can get stuck by usingtransfer: https://ethereum.stackexchange.com/a/74007/42 – eth Aug 18 '19 at 07:55