1

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1)

struct Bidder {
    address bidders_address;
    uint productId;
    uint bidValue;
}

struct Product {
    uint productId;
    uint bidStartPrice;
    uint32 bidStartTime;
    Bidder latestBid;
    string productName;
    bool isAvailable;
    uint32 bidSession;

}

And mapping as

mapping(uint => Product) product;

removed the public getter venerability but still, the error is coming.

This is my full code :

    pragma solidity >=0.4.21 <0.6.0;

    import "./AucSters.sol";
    import "../libraries/SafeMath.sol";

    contract BiddingContract {

    using SafeMath for uint; 

    address admin;
    AucSters public tokenContract;
    uint256 public tokenPrice;
    uint256 public tokensSold;

    //structs
    struct Seller {
        uint256 sellerId;
        string sellerName;
        bool isValidSeller;
    }
    struct Bidder {
        address bidders_address;
        uint productId;
        uint bidValue;
    }
    struct Product {
        uint productId;
        uint bidStartPrice;
        uint32 bidStartTime;
        Bidder latestBid;
        string productName;
        bool isAvailable;
        uint32 bidSession;

    }

    mapping(address => Seller) registeredSeller;
    mapping(uint => address) public productIdToOwner;
    mapping(address => uint) public productCount;
    mapping(uint => Product) product;
    mapping(address => mapping(uint => uint)) public latestBidStore;

    //ARRAYS
    address[] public regSellers;
    Product[] public productsForSale;
    address[] public bidders;


    constructor(AucSters _tokenContract, uint _tokenPrice) public {
        //Assign an admin
        admin = msg.sender;

        // token Contract 
        tokenContract = _tokenContract;

        //Token price
        tokenPrice = _tokenPrice;
   }


}
  • 1
    The code you shared so far compiles fine for me. Could you share the code that has the error? – smarx Jan 23 at 2:48
  • yeah sure , done – CryptoScroller Jan 23 at 2:53
  • I removed public from the declaration of product, I deleted all the lines that reference the AucSters contract (which you didn't provide a definition for). I converted the safe math references to normal math operations. After that, the code compiled fine. – smarx Jan 23 at 3:24
  • 1
    If you want more help, please provide a self-contained piece of code (something that can just be copy/pasted, without references to files you didn't provide) that exhibits the problem. Preferably, delete all the code that isn't necessary to reproduce the error. – smarx Jan 23 at 3:24
  • 1
    The code in the question still refers to AucSters and SafeMath without providing code for either. It would also help to know what Solidity version you're using. Your pragma allows a lot of different versions. – smarx Jan 23 at 4:06
0

I got the issue solved !

The array declares productsForSale also gives a by default getter as it is public, remove public and it will work

Product[] public productsForSale;

replace it by

 Product[] productsForSale;
  • 1
    In case it helps, that's because it contains a struct (Bidder) and the "free" getter requested with public doesn't support that. – Rob Hitchens - B9lab Jan 23 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.