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.

uint256: personId 0
address: personAddress 0x0000000000000000000000000000000000000000
uint256: earning 0
uint256: tokenCount 0
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?
  • 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


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.