I have a contract that implements the following function:

    function getVehicles(address _addr) public view returns(Vehicle [] memory) {
        return addres_vehicles_map[_addr];

I have activated the experimental pragma ABIEncoderV2. The struct Vehicle is:

    struct Vehicle {
        string registration_ID;
        string brand;
        string model;
        string vehicle_docs_id; 
        uint256 price;
        address seller;

When obtaining the price everything works correctly with remix IDE, but when obtaining it with web3 the price number is not correct:

  • Whit remix IDE0: tuple(string,string,string,string,uint256,address)[]: CNP 1212,Tesla,Model Y,787856FGHJ,100000000000000000,0x88bFe284B409730Cd5bE6f02f37C682790DAE7C5
  • But with Web3: 0: "rt" 1: "rt" 2: "rt" 3: "rtg" 4: "100000000000" 5: "0x03d8dBAFFc736c5Ef644a01107988F31F2e414bc"

That is directly what the transaction returns, without converting any data or doing anything with them

As you can see the price parameter does not match.

I am stuck on this problem and can't find a solution. Please help me. Thanks

  • 1
    "As you can see the price parameter does not match"??? As I can see, none of the other parameters match either, so it sounds like you're doing one thing via Remix and another (different) thing via web3. – goodvibration Apr 10 '20 at 5:40
  • OMG I can't believe it ... I mistakenly put the address of the contract and I was so locked in that parameter that I didn't even look at the rest ... Thanks – FSanchez Apr 10 '20 at 11:07

Your Answer

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

Browse other questions tagged or ask your own question.