I'm aware of this post:
Accessing a mapping within a struct via Truffle console
However, it seems to me, it does not provide a clear answer. Also, my question is more generic and not just for truffle. Also, there's similar code in here (section "structs") but couldn't find any answer to the below questions.
Case 1:
Assume we have the following pseudo-code in solidity:
mapping (uint => BB) public map_1;
struct BB{
mapping (uint => address) map_2;
}
Question : Given a key, how can I access the content of map_2 in Geth or a user interface?
Case 2:
Assume we have the following pseudo-code in solidity:
mapping (uint => BB) public map_1;
struct AA{
uint val;
}
struct BB{
mapping (uint => AA) map_2;
}
My question for this case remains the same as the one for case 1.
Best Answer
You can access the case 1s mapping by given the both keys. The key for
map_1
and key formap_2
. Usepragma solidity ^0.4.20;
when compilingCase 1
Case 2