mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update frequently-asked-questions.rst
This commit is contained in:
parent
0df5f40ac4
commit
9720851bd6
@ -666,21 +666,22 @@ gas and return your 20 Wei).
|
|||||||
In the above example, the low-level function `call` is used to invoke another
|
In the above example, the low-level function `call` is used to invoke another
|
||||||
contract with `p.data` as payload and `p.amount` Wei is sent with that call.
|
contract with `p.data` as payload and `p.amount` Wei is sent with that call.
|
||||||
|
|
||||||
What happens to a mapping copied from a mapping of structs?
|
What happens to a struct's mapping when copying over a struct?
|
||||||
===========================================================
|
==============================================================
|
||||||
|
|
||||||
This is a very interesting question. Suppose that we have a contract field set up like such::
|
This is a very interesting question. Suppose that we have a contract field set up like such::
|
||||||
|
|
||||||
struct user{
|
struct user{
|
||||||
mapping(string => address) usedContracts;
|
mapping(string => address) usedContracts;
|
||||||
}
|
}
|
||||||
mapping(uint => user) userList;
|
|
||||||
function somefunction{
|
function somefunction{
|
||||||
user userA = userList[1];
|
user user1;
|
||||||
userList[2] = userA;
|
user1.usedContracts["Hello"] = "World";
|
||||||
|
user user2 = user1;
|
||||||
}
|
}
|
||||||
|
|
||||||
In this case, the mapping of the struct being copied over into the userList is ignored.
|
In this case, the mapping of the struct being copied over into the userList is ignored as there is no "list of mapped keys".
|
||||||
|
Therefore it is not possible to find out which values should be copied over.
|
||||||
|
|
||||||
How do I initialize a contract with only a specific amount of wei?
|
How do I initialize a contract with only a specific amount of wei?
|
||||||
==================================================================
|
==================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user