松露编译

问题描述 投票:0回答:1

我得到这个错误松露当我编译。我曾尝试将支付给地址,但不会工作。这是错误:

类型错误:会员“转移”未找到或在地址参数相关的查找后不可见。 buyer.transfer(订单[order_no]。价格* 8/10); ^ ^ ------------

pragma solidity >0.4.99 <0.6.0;
contract ManageOrder{
   address public owner;
   uint256 count;
   uint256 count_parking;
   string order_list;
   uint256 order_number;
   string public result;

//order table
struct  Order {
   uint256 orderNo;
   address   buyer;
   address  seller;
   uint256 parkingNo;
   State state;
   string  new_hour;
   uint256 price;
   uint date;
   }

//parking table
struct  Parking {
   uint256 parkingNo;
   address seller;
   string  name;
   string  phone;
   string post_code;
   string  avail_hour;
   string  park_address;
   }

//buyer table
struct Buyer {
   string  name;
   string  phone;
}

//map the struct to an index
mapping(uint => Order) private Orders;
mapping(uint => Parking) private Parkings;
mapping(address => uint256) balances;
mapping(address => Buyer) public  Buyers;

//for sellers and buyers to abort the order
//order state should be pending
function abortOrder(uint256 order_no) public
    inState(State.Pending,order_no)
{
    //get the address of both the buyer and the seller
    address buyer = Orders[order_no].buyer;
    address seller = Orders[order_no].seller;
    //if the message sender id the buyer
    if(msg.sender==Orders[order_no].buyer)
    {
    Orders[order_no].state = State.Aborted;
    //return 80% of the money to buyer
    buyer.transfer(Orders[order_no].price*8/10);
    //20% of the money to the seller
    seller.transfer(Orders[order_no].price*2/10);
    }
    else if(msg.sender==Orders[order_no].seller)
    {
    //if the sender is the seller, he needs to pay 20% of the parking fee to the buyer
    Orders[order_no].state = State.Aborted;

    //return the money to buyer
    buyer.transfer(Orders[order_no].price*12/10);
    balances[seller]-=Orders[order_no].price*2/10;
    }
}
smartcontracts truffle
1个回答
0
投票

检查Solidiy 0.5.x.的重大更改

所述address类型被分成addressaddress payable,其中仅address payable提供transfer功能

https://solidity.readthedocs.io/en/v0.5.3/050-breaking-changes.html?highlight=address%20payable

© www.soinside.com 2019 - 2024. All rights reserved.