I have a special needs, store the mapping type struct with assembly code. thank you very for everyone who can response this question.

Need your help how to write something in assembly

Here is how I am trying todo

 mapping(uint256 => MyStruct) public myStruct;
       struct MyStruct {
        uint256 value;
        address myAddress;
        string email;
      function addUser(key, value, myaddress, email) public {
       MyStruct storage mystructInfo = myStruct[key]
      assembly {
        sstore(add(mystructInfo.slot, 1), value)
        sstore(add(mystructInfo.slot, 2), myAddress)
        sstore(add(mystructInfo.slot, 3), email)


Your Answer

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

Browse other questions tagged or ask your own question.