ethereum / meteor-dapp-wallet

This is an archived repository of one of the early Ethereum wallets.
https://ethereum.org/en/wallets/find-wallet/
GNU General Public License v3.0
598 stars 408 forks source link

Member Push Not found or not visible #513

Closed MahdiMbarki closed 3 years ago

MahdiMbarki commented 3 years ago

in the bid function I tried storing some values to struct memory and then push the struct instance into an array of structs and I keep getting this error: member push not found or not visible after argument dependent lookup in type struct

pragma solidity ^0.4.17;

contract Auction{ address public manager; uint public initbid; string public Vduration; string public Vresolution; string public Vname; string public Vhash; uint public Aduration; uint public MinInc; uint public highestbid; address public highestbidder; uint public Aendtime; mapping (address => uint) pendingreturns; bool ended; event highestbidincreased(address bidder, uint amount); event auctionended(address winner, uint amount);

struct Bid{
    address user;
    uint Inc;
}

Bid[] public allBids;

constructor (uint min, string vd, string vr, string vn, string vh, uint ad,uint mi )public {

    manager=msg.sender;
    initbid=min;
    Vduration=vd;
    Vresolution= vr;
    Vname=vn;
    Vhash=vh;
    Aduration=ad;
    MinInc=mi;
    Aendtime= now + Aduration;
}

function SubmitBid () public payable {

    require(msg.value>highestbid,"there are higher bids");
    if(highestbid!=0){
        pendingreturns[highestbidder]+=highestbid;
    }
    highestbidder=msg.sender;
    highestbid=msg.value;
    emit highestbidincreased(msg.sender, msg.value);

    Bid memory newBid = Bid({
        user:highestbidder,
        Inc:highestbid
    });
    Bid.push( newBid);

}

function withdraw()public returns (bool){
    uint amount= pendingreturns[msg.sender];
    if (amount>0){
        pendingreturns[msg.sender]=0;
       if (!msg.sender.send(amount)){
           pendingreturns[msg.sender]=amount;
           return false;
       }
    }
    return true;
}

function auctionend() public{
    require (now>=Aendtime,"auction ended due to time constraint");
    require(!ended,"arjaa ghodwa") ;
    ended=true;
    emit auctionended(highestbidder,highestbid);
    manager.tansfer(highestbid);
}

}