0

how to access the element of struct in array and mapping using assembly?

my code case:

contract Test {
    struct User {
        address addr;
        uint256 tokenAmount;
    }

    mapping (uint256 => User[]) public user;
    mapping (address => uint256) public userId;

    function test(uint256 pid, uint256 uid) {
        // how to implement the two code lines using assembly?
        User memory user_ =  user[pid][uid];
        userId[user_.addr] = userId[user_.addr] + 1;
    }
}

Thank u very much!!

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.