0

I have an interface.

interface IAuction {
    struct Auctioneer {
        uint256 a;
        uint256 b;
        bool c;
        address d;
        uint256 e;
        uint256 f;
        string[] bids;
    }
}

and a contract that implements the interface.

contract Auction is IAuction {

  mapping(address => Auctioneer) public auctions;

  string[] encryptedBids;

  function register(
        uint256 start,
        uint256 end
    ) external payable {
        require(msg.value > 0, "You did not specify the payment!");
        auctions[msg.sender] = Auctioneer(
            msg.value,
            0,
            true,
            address(0),
            start,
            end,
           encryptedBids
        );
    }
  }

I use remix interface to register auction with dummy arguments; however, when I check auctions map I don't see the encryptedBids argument. It does show Auction struct has 6 field rather than 7. Why is this happening?

enter image description here

1 Answer 1

0

I belive it is because bids is string[].
Just like mapping, it it accessable only by KEY you provide,
but [ ] is accesable by index.
It probably has to do with how Remix is implemented to show array and mapping data...
You should probably have some function like:

function getBidsAtIndex(uint index) public view returns(string memory)
{
    return auctions[msg.sender].bids[index];
}

For accessing that data.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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