0

I am creating a record of people and have created a structure

struct asset{
    uint assetId;
    string hash;
    address creatorAddress;
    uint cost;
    uint soldCount;
}

struct person{
    uint personId;
    address personAddress;
    uint earning;
    uint tokenCount;
    uint[] assetsUploaded;
    uint[] assetsBought;
    bool initialized;
}

mapping (uint => asset) public assets;
mapping (uint => person) public persons;

I am creating a new person as

        persons[personCount].personAddress = _sender;
        persons[personCount].earning= 0;
        persons[personCount].tokenCount = 0 ;
        persons[personCount].initialized = true;
        persons[personCount].assetsUploaded = new uint[](0);
        persons[personCount].assetsBought = new uint[](0);```

after doing all this i am unable to know whether the array is created or not because it is not showing up in remix.

**REMIX OUTPUT**
0:
uint256: personId 0
1:
address: personAddress 0x0000000000000000000000000000000000000000
2:
uint256: earning 0
3:
uint256: tokenCount 0
4:
bool: initialized false

assetsUploaded and assetsBought are missing here in the remix output

I am adding assets in assetsUploaded but am unable to see them. Is there any issue in the code which i need to fix?
10
  • What is persons? Jan 3, 2021 at 11:35
  • mapping (uint => person) public persons; Jan 3, 2021 at 11:36
  • Also, please share all the relevant details in plain text (no links or images). Jan 3, 2021 at 11:36
  • "I am adding assets in assetsUploaded": What is assets??? How are you adding it??? Jan 3, 2021 at 11:37
  • This question is really low-quality! Jan 3, 2021 at 11:37

0

Your Answer

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

Browse other questions tagged or ask your own question.